Comments (4)
I'm having the same error for some texts in another language despite passing hint in initializing the text. Is there a way to suppress this language inference of the NER?
from polyglot.
Can you please provide the text you have in this issue? Since we cannot reproduce this issue yet.
from polyglot.
Sure, here is an example:
In [1]: u = u'Akihiro Gono é um lutador japonês de MMA. Já venceu Gegard Mousasi, Hector Lombard e Hayato Sakurai.'
In [3]: from polyglot.text import Text
In [4]: output_tuples = []
In [5]: text = Text(u, hint_language_code="pt")
In [6]: for sent in text.sentences:
...: output_tuples.append([((ent.start, ent.end), ent.tag, 1.) for ent in sent.entities])
...:
This then generates the following stacktrace
No handlers could be found for logger "polyglot.detect.base"
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-6-fcec27e389bd> in <module>()
1 for sent in text.sentences:
----> 2 output_tuples.append([((ent.start, ent.end), ent.tag, 1.) for ent in sent.entities])
3
/home/preceptor/miniconda2/envs/wiki/lib/python2.7/site-packages/polyglot/decorators.pyc in __get__(self, obj, cls)
18 if obj is None:
19 return self
---> 20 value = obj.__dict__[self.func.__name__] = self.func(obj)
21 return value
22
/home/preceptor/miniconda2/envs/wiki/lib/python2.7/site-packages/polyglot/text.pyc in entities(self)
130 prev_tag = u'O'
131 chunks = []
--> 132 for i, (w, tag) in enumerate(self.ne_chunker.annotate(self.words)):
133 if tag != prev_tag:
134 if prev_tag == u'O':
/home/preceptor/miniconda2/envs/wiki/lib/python2.7/site-packages/polyglot/decorators.pyc in __get__(self, obj, cls)
18 if obj is None:
19 return self
---> 20 value = obj.__dict__[self.func.__name__] = self.func(obj)
21 return value
22
/home/preceptor/miniconda2/envs/wiki/lib/python2.7/site-packages/polyglot/text.pyc in ne_chunker(self)
98 @cached_property
99 def ne_chunker(self):
--> 100 return get_ner_tagger(lang=self.language.code)
101
102 @cached_property
/home/preceptor/miniconda2/envs/wiki/lib/python2.7/site-packages/polyglot/decorators.pyc in memoizer(*args, **kwargs)
28 key = tuple(list(args) + sorted(kwargs.items()))
29 if key not in cache:
---> 30 cache[key] = obj(*args, **kwargs)
31 return cache[key]
32 return memoizer
/home/preceptor/miniconda2/envs/wiki/lib/python2.7/site-packages/polyglot/tag/base.pyc in get_ner_tagger(lang)
190 def get_ner_tagger(lang='en'):
191 """Return a NER tagger from the models cache."""
--> 192 return NEChunker(lang=lang)
/home/preceptor/miniconda2/envs/wiki/lib/python2.7/site-packages/polyglot/tag/base.pyc in __init__(self, lang)
102 lang: language code to decide which chunker to use.
103 """
--> 104 super(NEChunker, self).__init__(lang=lang)
105 self.ID_TAG = NER_ID_TAG
106
/home/preceptor/miniconda2/envs/wiki/lib/python2.7/site-packages/polyglot/tag/base.pyc in __init__(self, lang)
38 """
39 self.lang = lang
---> 40 self.predictor = self._load_network()
41 self.ID_TAG = {}
42 self.add_bias = True
/home/preceptor/miniconda2/envs/wiki/lib/python2.7/site-packages/polyglot/tag/base.pyc in _load_network(self)
107 def _load_network(self):
108 """ Building the predictor out of the model."""
--> 109 self.embeddings = load_embeddings(self.lang, type='cw')
110 self.embeddings.normalize_words(inplace=True)
111 self.model = load_ner_model(lang=self.lang, version=2)
/home/preceptor/miniconda2/envs/wiki/lib/python2.7/site-packages/polyglot/decorators.pyc in memoizer(*args, **kwargs)
28 key = tuple(list(args) + sorted(kwargs.items()))
29 if key not in cache:
---> 30 cache[key] = obj(*args, **kwargs)
31 return cache[key]
32 return memoizer
/home/preceptor/miniconda2/envs/wiki/lib/python2.7/site-packages/polyglot/load.pyc in load_embeddings(lang, task, type)
58 """
59 src_dir = "_".join((type, task)) if type else task
---> 60 p = locate_resource(src_dir, lang)
61 e = Embedding.load(p)
62 if type == "cw":
/home/preceptor/miniconda2/envs/wiki/lib/python2.7/site-packages/polyglot/load.pyc in locate_resource(name, lang, filter)
44 raise ValueError("This resource is available in the index "
45 "but not downloaded, yet. Try to run\n\n"
---> 46 "polyglot download {}".format(package_id))
47 return path.join(p, os.listdir(p)[0])
48
ValueError: This resource is available in the index but not downloaded, yet. Try to run
polyglot download embeddings2.da
from polyglot.
Simply follow what the error says:
in your command line write: polyglot download embeddings2.da
from polyglot.
Related Issues (20)
- Download Problem
- word.morphemes returns "ValueError: Package 'morph2.da ' not found in index" when script is run, but works when run interactively HOT 1
- UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 4941: character maps to <undefined>
- ImportError: cannot import name 'SIGPIPE'
- Egregious detections
- Polyglot Morfessor Models HOT 1
- installation error HOT 3
- Status of the project? HOT 3
- pip install polyglot error: subproc exit with error:
- English to Japanese Transliteration
- translate English into Chinese
- Underscores make sentences detected as English?
- [1] 7092 segmentation fault python - Error is coming HOT 2
- polyglot download failing HOT 2
- Licensing issue for polyglot
- kbnblnejcfcvlkihlvjilrubllivlibecclvteugcjvb
- Missing settings for data path for collections
- word arabic detect false positive
- list of supported languages
- list of supported languages about Tokenization!why 165 Languages
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from polyglot.