mrmechko / pytrips Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v2.0
License: GNU General Public License v2.0
pytrips/pytrips/structures/sem.py
Lines 58 to 63 in 5ead581
TODO
comment in 5ead581. It's been assigned to @mrmechko because they committed the code.A sequence of basic tests for the Ontology. Should be testing:
Add type hints to code if possible.
Allow calling trips-web
via code. Probably better to just run it from trips-web
though.
details tbd..
Implement basic similarity metrics over ontologies:
Hi,
I get the following error when I run the following from the root of the directory:
pip install -e .
Command "/Users/sidvash/anaconda/bin/python -c "import setuptools, tokenize;file='/Users/sidvash/pytrips/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" develop --no-deps" failed with error code 1 in /Users/sidvash/pytrips/
OS: macOS High Sierra v10.13.3
Python Version: Python 3.6.5 :: Anaconda custom (64-bit)
Hello developers,
While using PyTrips, I have found time and time again that functionality of PyTrips is overly reliant on strings, as it appears that the prefix q::
, wn::
, ont::
, etc., are all required to obtain appropriate functionality. This has been a significant source of frustration for me, and I'd like to provide an example as to why and how I would hope the API that PyTrips provides can be dramatically improved.
In my final project for Natural Language Processing, I have an AMR parse of the following sentence...
Sentence: Hallmark could make a fortune off of this guy.
This produces an AMR parse that looks like the following...
(p / possible
:domain (m / make-05
:ARG0 (c / company :name (n / name :op1 "Hallmark"))
:ARG1 (f / fortune
:source (g / guy
:mod (t / this)))))
While I have been mostly successful by using TRIPS' lexicon (get_word
) to obtain the possible ontological mappings for all but fortune
, which produces what I believe to be a nonsensical ontological type: ont::cookies
. It is honestly so far out of left-field that it causes me to reconsider how to proceed with parsing this given that it is so far from what it is supposed to do that I can't, say, choose based on what is more likely given the only provided candidate is clearly wrong. Here, I have tried to obtain the wordnet mapping (get_wordnet
), but it produces an empty list. The definition (get_definition
) throws an exception, and lookup
requires a pos
.
Now after spending more time than I should have, I eventually found that I can obtain the wordnet mappings, but only by invoking make_query('q::fortune')
which returns a dictionary of exactly what I want to see...
{'lex': [ont::cookies],
'wn': [ont::assets, ont::luckiness-scale, ont::situation]}
My issue is: Why doesn't get_wordnet
return this? I am working with strings, yes, but I feel as if I shouldn't have to prepend a q::
to each query, and that instead there should be explicit functions and/or methods that can produce the same results. I.E, if get_wordnet
produced the [ont::assets, ont::luckiness-scale, ont::situation]
, I would be satisfied enough. I am not certain what it does right now. Also lookup
requires a pos
, in which I cannot find documentation as to what it actually means or expects.
I am requesting that PyTrips provides some kind of enhanced API that can appropriately obtain this type of information without relying on string manipulation.
>>> ont.items()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Trips' object has no attribute 'items'
pytrips/pytrips/structures/sem.py
Lines 36 to 41 in 5ead581
TODO
comment in 5ead581. It's been assigned to @mrmechko because they committed the code.get setup.py
in order
Hi
Thanks for this work.
I got an error msg when loading ontology. i used the following code
pip install pytrips
pip install pytrips[tools] # optional
import nltk
nltk.download('wordnet')
from pytrips.ontology import load
ont = load()
KeyError: 'restriction' line 45 in ontology.py
i think it should be restr?
ont['event-of-causation'].word_closure()
returns an empty set with any chosen depth.
To replicate the issue, you can run this:
from pytrips.ontology import load
ont = load()
for i in range(10):
ont.max_wn_depth = i
print("Number of words in closure with depth {} - {}".format(i, len(ont['event-of-causation'].word_closure())))
Output:
Number of words in closure with depth 0 - 0
Number of words in closure with depth 1 - 0
Number of words in closure with depth 2 - 0
Number of words in closure with depth 3 - 0
Number of words in closure with depth 4 - 0
Number of words in closure with depth 5 - 0
Number of words in closure with depth 6 - 0
Number of words in closure with depth 7 - 0
Number of words in closure with depth 8 - 0
Number of words in closure with depth 9 - 0
Is this something expected or a bug?
I am a bit confused as to which version of the ontology pytrips is using. It seems to load the ontology from jsontrips as a large file.
I assume that predates Collie. If so, is there a way to move to Collie, which seems to use separate ontology files. SInce pytrips incorporates wordnet maybe there is little benefit to that??
By the way, thanks for pytrips!!
Load semantic features from json.
Document the code for loading the ontology and its basic functionality. Include basic descriptions of how TRIPS is organized and functions.
demo.ipynb
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.