bjascob / pysimplenlg Goto Github PK
View Code? Open in Web Editor NEWA python port of SimpleNLG
License: Other
A python port of SimpleNLG
License: Other
I tried some basic example with pySimplNLG. However, verbs are systematically omitted from the final output.
I used the following code:
`import simplenlg as nlg
nlg_factory = nlg.NLGFactory()
lexicon = nlg.lexicon.Lexicon()
realiser = nlg.realiser.Realiser(lexicon)
p = nlg_factory.createClause()
p.setSubject("The dog")
p.setVerb("bite")
p.setObject("the monkey")
p.setFeature(nlg.Feature.TENSE,nlg.Tense.PAST)
print(realiser.realiseSentence(p))`
which only produces
The dog the monkey.
Just to make sure, I also checked the original JAVA-code from which this package has been built.
That code does create proper sentences with verbs. So I guess there must be a bug in the python version.
Hi, do you have tutorials or examples on how to use pysimplenlg please?
I installed the simplenlg module locally and ran your tutorial test file. Got this error.
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.================ RESTART: C:\Users\jb00557372\Desktop\test.py ================
EEEEEEEEEEEEERROR: testSection10 (main.TutorialTest)
Traceback (most recent call last):
File "C:\Users\jb00557372\Desktop\test.py", line 234, in testSection10
lexicon = Lexicon.getDefaultLexicon() # default simplenlg lexicon
File "C:\Users\jb00557372\AppData\Local\Programs\Python\Python37-32\lib\site-packages\simplenlg\lexicon\Lexicon.py", line 33, in getDefaultLexicon
return XMLLexicon()
File "C:\Users\jb00557372\AppData\Local\Programs\Python\Python37-32\lib\site-packages\simplenlg\lexicon\XMLLexicon.py", line 46, in init
self.createLexicon(lexicon_fn)
File "C:\Users\jb00557372\AppData\Local\Programs\Python\Python37-32\lib\site-packages\simplenlg\lexicon\XMLLexicon.py", line 52, in createLexicon
tree = ET.parse(xmlfile)
File "C:\Users\jb00557372\AppData\Local\Programs\Python\Python37-32\lib\xml\etree\ElementTree.py", line 1197, in parse
tree.parse(source, parser)
File "C:\Users\jb00557372\AppData\Local\Programs\Python\Python37-32\lib\xml\etree\ElementTree.py", line 587, in parse
source = open(source, "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\jb00557372\AppData\Local\Programs\Python\Python37-32\lib\site-packages\simplenlg\resources\default-lexicon.xml'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.