Giter Site home page Giter Site logo

pytrips's People

Contributors

anyhannah avatar bavalpey avatar mrmechko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

rocnlp bavalpey

pytrips's Issues

the values can still be a list (ie a union or parameterized)

# TODO: the values can still be a list (ie a union or parameterized)
values = " ".join([":{} {}".format(k, str(v)) for k, v in values[:2]])
return "({} {}{})".format(self.type, values, ellipsis)
def __repr__(self):
return "<TripsSem {}>".format(str(self))


This issue was generated by todo based on a TODO comment in 5ead581. It's been assigned to @mrmechko because they committed the code.

Ontology Testing

A sequence of basic tests for the Ontology. Should be testing:

  • hierarchy
  • content
  • lexicon mappings
  • wordnet mappings
  • similarity
  • equality, set manipulation etc
  • lookup and queries

Load the Lexicon

  • extract morphology
    • load spacy or NLTK
    • stemming
  • identify lexical entries
  • link syntactic templates

Integrate `trips-web`

Allow calling trips-web via code. Probably better to just run it from trips-web though.

Similarity Metrics

Implement basic similarity metrics over ontologies:

  • path distance
  • wu-palmer
  • cosine

Error installing: pip install -e

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)

Overly reliant on string prefixes (Query wordnet mapping without `q::` prefix)

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.

ontology iterator doesn't work

>>> ont.items()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'Trips' object has no attribute 'items'

ontology load error

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()` is empty with any depth

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?

Collie version of the ontology?

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!!

Ontology Documentation

Document the code for loading the ontology and its basic functionality. Include basic descriptions of how TRIPS is organized and functions.

  • Ontology organization
  • JSON format
  • demo.ipynb
  • outline of algorithms

incorporate the lexicon

pytrips/pytrips/ontology.py

Lines 103 to 108 in 499e53c

# TODO: incorporate the lexicon
if len(entries['senses']) > 1:
logger.info(entries["name"] + " has " + str(len(entries["senses"])) + " senses")
for values in entries["senses"]:
if "lf_parent" not in values.keys():
c = "no_parent"


This issue was generated by todo based on a TODO comment in 499e53c. It's been assigned to @mrmechko because they committed the code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.