spaCy/spacy/lang/pt/tokenizer_exceptions.py

75 lines
1.6 KiB
Python
Raw Normal View History

# coding: utf8
from __future__ import unicode_literals
2017-11-06 16:41:53 +00:00
from ...symbols import ORTH, LEMMA, NORM, PRON_LEMMA
2017-05-08 13:52:01 +00:00
_exc = {
"às": [
{ORTH: "à", NORM: "a"},
2017-05-08 13:52:01 +00:00
{ORTH: "s", NORM: "as"}],
"ao": [
{ORTH: "a"},
2017-05-08 13:52:01 +00:00
{ORTH: "o"}],
"aos": [
{ORTH: "a"},
2017-05-08 13:52:01 +00:00
{ORTH: "os"}],
"àquele": [
{ORTH: "à", NORM: "a"},
2017-05-08 13:52:01 +00:00
{ORTH: "quele", NORM: "aquele"}],
"àquela": [
{ORTH: "à", NORM: "a"},
2017-05-08 13:52:01 +00:00
{ORTH: "quela", NORM: "aquela"}],
"àqueles": [
{ORTH: "à", NORM: "a"},
2017-05-08 13:52:01 +00:00
{ORTH: "queles", NORM: "aqueles"}],
"àquelas": [
{ORTH: "à", NORM: "a"},
2017-05-08 13:52:01 +00:00
{ORTH: "quelas", NORM: "aquelas"}],
"àquilo": [
{ORTH: "à", NORM: "a"},
2017-05-08 13:52:01 +00:00
{ORTH: "quilo", NORM: "aquilo"}],
"aonde": [
{ORTH: "a"},
2017-05-08 13:52:01 +00:00
{ORTH: "onde"}]
}
# Contractions
_per_pron = ["ele", "ela", "eles", "elas"]
_dem_pron = ["este", "esta", "estes", "estas", "isto", "esse", "essa", "esses",
"essas", "isso", "aquele", "aquela", "aqueles", "aquelas", "aquilo"]
_und_pron = ["outro", "outra", "outros", "outras"]
_adv = ["aqui", "", "ali", "além"]
for orth in _per_pron + _dem_pron + _und_pron + _adv:
_exc["d" + orth] = [
{ORTH: "d", NORM: "de"},
{ORTH: orth}]
for orth in _per_pron + _dem_pron + _und_pron:
_exc["n" + orth] = [
{ORTH: "n", NORM: "em"},
{ORTH: orth}]
for orth in [
"Adm.", "Dr.", "e.g.", "E.g.", "E.G.", "Gen.", "Gov.", "i.e.", "I.e.",
"I.E.", "Jr.", "Ltd.", "p.m.", "Ph.D.", "Rep.", "Rev.", "Sen.", "Sr.",
"Sra.", "vs."]:
_exc[orth] = [{ORTH: orth}]
TOKENIZER_EXCEPTIONS = _exc