spaCy/spacy/lang/entity_rules.py

52 lines
1.7 KiB
Python
Raw Normal View History

2017-03-12 15:07:28 +03:00
# coding: utf8
2016-12-18 17:36:09 +03:00
from __future__ import unicode_literals
from ..symbols import ORTH, ENT_TYPE, LOWER
2017-05-08 23:23:48 +03:00
ENT_ID = "ent_id"
2017-05-09 02:37:10 +03:00
ENTITY_RULES = []
for name, tag, patterns in [
("Reddit", "PRODUCT", [[{LOWER: "reddit"}]]),
("Linux", "PRODUCT", [[{LOWER: "linux"}]]),
("Haskell", "PRODUCT", [[{LOWER: "haskell"}]]),
("HaskellCurry", "PERSON", [[{LOWER: "haskell"}, {LOWER: "curry"}]]),
("Javascript", "PRODUCT", [[{LOWER: "javascript"}]]),
("CSS", "PRODUCT", [[{LOWER: "css"}], [{LOWER: "css3"}]]),
("HTML", "PRODUCT", [[{LOWER: "html"}], [{LOWER: "html5"}]]),
("Python", "PRODUCT", [[{ORTH: "Python"}]]),
("Ruby", "PRODUCT", [[{ORTH: "Ruby"}]]),
("spaCy", "PRODUCT", [[{LOWER: "spacy"}]]),
("displaCy", "PRODUCT", [[{LOWER: "displacy"}]]),
("Digg", "PRODUCT", [[{LOWER: "digg"}]]),
("FoxNews", "ORG", [[{LOWER: "foxnews"}], [{LOWER: "fox"}, {LOWER: "news"}]]),
("Google", "ORG", [[{LOWER: "google"}]]),
("Mac", "PRODUCT", [[{LOWER: "mac"}]]),
("Wikipedia", "PRODUCT", [[{LOWER: "wikipedia"}]]),
("Windows", "PRODUCT", [[{LOWER: "windows"}]]),
("Dell", "ORG", [[{LOWER: "dell"}]]),
("Facebook", "ORG", [[{LOWER: "facebook"}]]),
("Blizzard", "ORG", [[{LOWER: "blizzard"}]]),
("Ubuntu", "ORG", [[{LOWER: "ubuntu"}]]),
("YouTube", "PRODUCT", [[{LOWER: "youtube"}]]),
]:
ENTITY_RULES.append({ENT_ID: name, "attrs": {ENT_TYPE: tag}, "patterns": patterns})
2016-12-18 17:36:09 +03:00
FALSE_POSITIVES = [
[{ORTH: "Shit"}],
[{ORTH: "Weed"}],
[{ORTH: "Cool"}],
[{ORTH: "Btw"}],
[{ORTH: "Bah"}],
[{ORTH: "Bullshit"}],
[{ORTH: "Lol"}],
[{ORTH: "Yo"}, {LOWER: "dawg"}],
[{ORTH: "Yay"}],
[{ORTH: "Ahh"}],
[{ORTH: "Yea"}],
[{ORTH: "Bah"}],
2016-12-18 17:36:09 +03:00
]