text.
* Kasami, T. (1965). An efficient recognition and syntax analysis algorithm
for context-free languages. (No. Scientific-2). Hawaii University, Dept. of
Electrical Engineering.
# Example use
```python
>>> from bllipparser import RerankingParser
>>>
>>> from kasami import TreeScorer
>>> from kasami.normalizers import bllip
>>>
>>> # Loading WSJ-PTB3 treebank into bllip's RerankingParser
... bllip_rrp = RerankingParser.fetch_and_load('WSJ-PTB3')
>>> bllip_parse = lambda s: bllip.normalize_tree(bllip_rrp.parse(s)[0].ptb_parse)
>>>
>>> tree = bllip_parse("I am a little teapot")
>>> print(tree)
(S1 (S (NP (PRP 'I')) (VP (VBP 'am') (NP (DT 'a') (JJ 'little') (NN 'teapot')))))
>>> print(tree.format(depth=1))
(S1
(S
(NP
(PRP 'I')
)
(VP
(VBP 'am')
(NP
(DT 'a')
(JJ 'little')
(NN 'teapot')
)
)
)
)
>>>
>>> for production in tree:
... print(str(production))
...
(S1 S)
(S NP VP)
(NP PRP)
(PRP 'I')
(VP VBP NP)
(VBP 'am')
(NP DT JJ NN)
(DT 'a')
(JJ 'little')
(NN 'teapot')
>>> sentences = ["I am a little teapot",
... "Here is my handle",
... "Here is my spout",
... "When I get all steamed up I just shout tip me over and pour me out",
... "I am a very special pot",
... "It is true",
... "Here is an example of what I can do",
... "I can turn my handle into a spout",
... "Tip me over and pour me out"]
>>>
>>>
>>> teapot_grammar = TreeScorer.from_tree_bank(bllip_parse(s) for s in sentences)
>>>
>>> teapot_grammar.score(bllip_parse("Here is a little teapot"))
-9.392661928770137
>>> teapot_grammar.score(bllip_parse("It is my handle"))
-10.296301543090733
>>> teapot_grammar.score(bllip_parse("I am a spout"))
-10.40166205874856
>>> teapot_grammar.score(bllip_parse("Your teapot is gay"))
-12.96352974967269
>>> teapot_grammar.score(bllip_parse("Your mom's teapot is asldasnldansldal"))
-19.424997926026403
```
# Author
* Aaron Halfaker -- https://github.com/halfak
... and substantially informed by https://github.com/aetilley
Metadata
Release files for kasami 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kasami-0.0.7.tar.gz | 7.2 kB | Without provenance | Details for kasami-0.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kasami-0.0.7-py3-none-any.whl | Python 3 | none | any | Details for kasami-0.0.7-py3-none-any.whl |
Total release size: 18.7 kB
Release files / kasami-0.0.7.tar.gz
| Download URL | kasami-0.0.7.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f821c030ac65be4d1cc219beaa22ea2e97877b0d19a6561f69ce29d8b20883d0
|
|
BLAKE2b-256 checksum How to use checksums |
822e4a9cb57823bc86caba8cae20c9d885ed3e70f0b7708fe837d130a95f3ebe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / kasami-0.0.7-py3-none-any.whl
| Download URL | kasami-0.0.7-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
19eac1ac9bf5ddf02386cbbc8718ea4c6a7c1367b4c6523850981cb368bf20ca
|
|
BLAKE2b-256 checksum How to use checksums |
ffc641fc6fefb0596c6bd1bbb554aa2a5c08067be856f576dde20d17f805e186
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for kasami 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.