Giter Club home page Giter Club logo

Comments (5)

ghpu avatar ghpu commented on August 15, 2024 1

Unfortunately, I haven't stored the wikipedia corpuses any longer. They were downloaded on February 22th
I have upgraded my system since, and am trying again with the updated code, will keep you informed if it is now solved.

from deeptype.

ghpu avatar ghpu commented on August 15, 2024 1

Problem solved with latest version of code (commit 7271648) , Python 3.6rc5 on Ubuntu Bionic Beaver (18.04), and latest wikipedia dumps (as of 23th March 2018).

Thanks for your time !

from deeptype.

ghpu avatar ghpu commented on August 15, 2024

More changes are required : Human can be replaced by 'Q5', but Food cannot be replaced by 'Q2095'

issue running 'extraction/classifiers/type_classifier.py', please fix.
'enwiki/Q2095'
Traceback (most recent call last):
File "extraction/project_graph.py", line 123, in main
classification = classifier.classify(collection)
File "extraction/classifiers/type_classifier.py", line 32, in classify
FOOD = wkp(c, "Q2095")
File "extraction/classifiers/type_classifier.py", line 14, in wkp
return c.article2id['enwiki/' + name][0][0]
File "src/marisa_trie.pyx", line 578, in marisa_trie.BytesTrie.getitem (src/marisa_trie.cpp:10859)
KeyError: 'enwiki/Q2095'

from deeptype.

JonathanRaiman avatar JonathanRaiman commented on August 15, 2024

In classifiers two function help with construct indices from string names:

def wkp(c, name):
    return c.article2id['enwiki/' + name][0][0]

def wkd(c, name):
    return c.name2index[name]

the wkp function uses Wikipedia titles to get a numeric id (but assumes the name is from the English wikipedia), while wkd uses Wikidata's id scheme to get a numeric id. So you would have wkp(c, "Human") == wkd(c, "Q5").
Is there any other information you could give about this problem (e.g. Python version, wikipedia corpuses you extracted to run this) ?

Also, random theory: the issue might be bytes vs. str in the case you mentioned (e.g. do:

def wkp(c, name):
    return c.article2id[('enwiki/' + name).encode("utf-8")][0][0]

If for some reason marisa-trie requires byte keys on your installed version

from deeptype.

JonathanRaiman avatar JonathanRaiman commented on August 15, 2024

Thanks! Please re-open when if the problem persists :)

from deeptype.

Related Issues (20)

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.