Spacy NER : identify named entity based on list of values

179 views Asked by At

I'd like to specify an entity pattern based on list of values (coming from csv file). These values can contains multiple words. In my case i'm looking for french city name (ex : "Saint Etienne", "Aix en Provence").

I tried to create a rule like this one :

pattern = [{'label': '_VILLE_',
  'pattern': [{'LOWER': {'IN': city_list}}],
            'id': 'VILLE'}]

But it matches every part of words in list, eg : "Saint" even if the sequence is not complete.

Which components would be the best to use in this case ? Rule based matching, phrase matcher ?

Any idea will appreciated.

0

There are 0 answers