2020-07-22 20:18:46 +00:00
|
|
|
from ..tokenizer_exceptions import BASE_EXCEPTIONS
|
2020-07-22 21:09:01 +00:00
|
|
|
from ...symbols import NORM, ORTH
|
2020-07-22 20:18:46 +00:00
|
|
|
from ...util import update_exc
|
2017-02-05 10:42:52 +00:00
|
|
|
|
2017-05-08 13:54:29 +00:00
|
|
|
_exc = {}
|
|
|
|
|
2017-02-05 10:42:52 +00:00
|
|
|
|
2017-01-19 13:08:52 +00:00
|
|
|
# Verbs
|
|
|
|
|
|
|
|
for verb_data in [
|
|
|
|
{ORTH: "driver"},
|
|
|
|
{ORTH: "kör"},
|
2020-07-22 21:09:01 +00:00
|
|
|
{ORTH: "hörr"},
|
2017-01-19 13:08:52 +00:00
|
|
|
{ORTH: "fattar"},
|
2020-07-22 21:09:01 +00:00
|
|
|
{ORTH: "hajar"},
|
2017-01-19 13:08:52 +00:00
|
|
|
{ORTH: "lever"},
|
2020-07-22 21:09:01 +00:00
|
|
|
{ORTH: "serr"},
|
💫 Tidy up and auto-format .py files (#2983)
<!--- Provide a general summary of your changes in the title. -->
## Description
- [x] Use [`black`](https://github.com/ambv/black) to auto-format all `.py` files.
- [x] Update flake8 config to exclude very large files (lemmatization tables etc.)
- [x] Update code to be compatible with flake8 rules
- [x] Fix various small bugs, inconsistencies and messy stuff in the language data
- [x] Update docs to explain new code style (`black`, `flake8`, when to use `# fmt: off` and `# fmt: on` and what `# noqa` means)
Once #2932 is merged, which auto-formats and tidies up the CLI, we'll be able to run `flake8 spacy` actually get meaningful results.
At the moment, the code style and linting isn't applied automatically, but I'm hoping that the new [GitHub Actions](https://github.com/features/actions) will let us auto-format pull requests and post comments with relevant linting information.
### Types of change
enhancement, code style
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2018-11-30 16:03:03 +00:00
|
|
|
{ORTH: "fixar"},
|
|
|
|
]:
|
2017-01-19 13:08:52 +00:00
|
|
|
verb_data_tc = dict(verb_data)
|
|
|
|
verb_data_tc[ORTH] = verb_data_tc[ORTH].title()
|
|
|
|
for data in [verb_data, verb_data_tc]:
|
2020-07-22 21:09:01 +00:00
|
|
|
_exc[data[ORTH] + "u"] = [data, {ORTH: "u", NORM: "du"}]
|
2016-12-22 21:45:18 +00:00
|
|
|
|
2019-01-16 12:45:50 +00:00
|
|
|
# Abbreviations for weekdays "sön." (for "söndag" / "söner")
|
|
|
|
# are left out because they are ambiguous. The same is the case
|
|
|
|
# for abbreviations "jul." and "Jul." ("juli" / "jul").
|
2017-05-08 13:54:29 +00:00
|
|
|
for exc_data in [
|
2020-07-22 21:09:01 +00:00
|
|
|
{ORTH: "jan.", NORM: "januari"},
|
|
|
|
{ORTH: "febr.", NORM: "februari"},
|
|
|
|
{ORTH: "feb.", NORM: "februari"},
|
|
|
|
{ORTH: "apr.", NORM: "april"},
|
|
|
|
{ORTH: "jun.", NORM: "juni"},
|
|
|
|
{ORTH: "aug.", NORM: "augusti"},
|
|
|
|
{ORTH: "sept.", NORM: "september"},
|
|
|
|
{ORTH: "sep.", NORM: "september"},
|
|
|
|
{ORTH: "okt.", NORM: "oktober"},
|
|
|
|
{ORTH: "nov.", NORM: "november"},
|
|
|
|
{ORTH: "dec.", NORM: "december"},
|
|
|
|
{ORTH: "mån.", NORM: "måndag"},
|
|
|
|
{ORTH: "tis.", NORM: "tisdag"},
|
|
|
|
{ORTH: "ons.", NORM: "onsdag"},
|
|
|
|
{ORTH: "tors.", NORM: "torsdag"},
|
|
|
|
{ORTH: "fre.", NORM: "fredag"},
|
|
|
|
{ORTH: "lör.", NORM: "lördag"},
|
|
|
|
{ORTH: "Jan.", NORM: "Januari"},
|
|
|
|
{ORTH: "Febr.", NORM: "Februari"},
|
|
|
|
{ORTH: "Feb.", NORM: "Februari"},
|
|
|
|
{ORTH: "Apr.", NORM: "April"},
|
|
|
|
{ORTH: "Jun.", NORM: "Juni"},
|
|
|
|
{ORTH: "Aug.", NORM: "Augusti"},
|
|
|
|
{ORTH: "Sept.", NORM: "September"},
|
|
|
|
{ORTH: "Sep.", NORM: "September"},
|
|
|
|
{ORTH: "Okt.", NORM: "Oktober"},
|
|
|
|
{ORTH: "Nov.", NORM: "November"},
|
|
|
|
{ORTH: "Dec.", NORM: "December"},
|
|
|
|
{ORTH: "Mån.", NORM: "Måndag"},
|
|
|
|
{ORTH: "Tis.", NORM: "Tisdag"},
|
|
|
|
{ORTH: "Ons.", NORM: "Onsdag"},
|
|
|
|
{ORTH: "Tors.", NORM: "Torsdag"},
|
|
|
|
{ORTH: "Fre.", NORM: "Fredag"},
|
|
|
|
{ORTH: "Lör.", NORM: "Lördag"},
|
|
|
|
{ORTH: "sthlm", NORM: "Stockholm"},
|
|
|
|
{ORTH: "gbg", NORM: "Göteborg"},
|
💫 Tidy up and auto-format .py files (#2983)
<!--- Provide a general summary of your changes in the title. -->
## Description
- [x] Use [`black`](https://github.com/ambv/black) to auto-format all `.py` files.
- [x] Update flake8 config to exclude very large files (lemmatization tables etc.)
- [x] Update code to be compatible with flake8 rules
- [x] Fix various small bugs, inconsistencies and messy stuff in the language data
- [x] Update docs to explain new code style (`black`, `flake8`, when to use `# fmt: off` and `# fmt: on` and what `# noqa` means)
Once #2932 is merged, which auto-formats and tidies up the CLI, we'll be able to run `flake8 spacy` actually get meaningful results.
At the moment, the code style and linting isn't applied automatically, but I'm hoping that the new [GitHub Actions](https://github.com/features/actions) will let us auto-format pull requests and post comments with relevant linting information.
### Types of change
enhancement, code style
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2018-11-30 16:03:03 +00:00
|
|
|
]:
|
2017-11-01 22:02:45 +00:00
|
|
|
_exc[exc_data[ORTH]] = [exc_data]
|
2016-12-22 21:45:18 +00:00
|
|
|
|
|
|
|
|
2019-01-16 12:45:50 +00:00
|
|
|
# Specific case abbreviations only
|
|
|
|
for orth in ["AB", "Dr.", "H.M.", "H.K.H.", "m/s", "M/S", "Ph.d.", "S:t", "s:t"]:
|
|
|
|
_exc[orth] = [{ORTH: orth}]
|
|
|
|
|
|
|
|
|
2018-08-07 11:53:17 +00:00
|
|
|
ABBREVIATIONS = [
|
💫 Tidy up and auto-format .py files (#2983)
<!--- Provide a general summary of your changes in the title. -->
## Description
- [x] Use [`black`](https://github.com/ambv/black) to auto-format all `.py` files.
- [x] Update flake8 config to exclude very large files (lemmatization tables etc.)
- [x] Update code to be compatible with flake8 rules
- [x] Fix various small bugs, inconsistencies and messy stuff in the language data
- [x] Update docs to explain new code style (`black`, `flake8`, when to use `# fmt: off` and `# fmt: on` and what `# noqa` means)
Once #2932 is merged, which auto-formats and tidies up the CLI, we'll be able to run `flake8 spacy` actually get meaningful results.
At the moment, the code style and linting isn't applied automatically, but I'm hoping that the new [GitHub Actions](https://github.com/features/actions) will let us auto-format pull requests and post comments with relevant linting information.
### Types of change
enhancement, code style
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2018-11-30 16:03:03 +00:00
|
|
|
"ang",
|
|
|
|
"anm",
|
|
|
|
"bl.a",
|
|
|
|
"d.v.s",
|
|
|
|
"doc",
|
|
|
|
"dvs",
|
|
|
|
"e.d",
|
|
|
|
"e.kr",
|
2019-02-07 19:54:07 +00:00
|
|
|
"el.",
|
💫 Tidy up and auto-format .py files (#2983)
<!--- Provide a general summary of your changes in the title. -->
## Description
- [x] Use [`black`](https://github.com/ambv/black) to auto-format all `.py` files.
- [x] Update flake8 config to exclude very large files (lemmatization tables etc.)
- [x] Update code to be compatible with flake8 rules
- [x] Fix various small bugs, inconsistencies and messy stuff in the language data
- [x] Update docs to explain new code style (`black`, `flake8`, when to use `# fmt: off` and `# fmt: on` and what `# noqa` means)
Once #2932 is merged, which auto-formats and tidies up the CLI, we'll be able to run `flake8 spacy` actually get meaningful results.
At the moment, the code style and linting isn't applied automatically, but I'm hoping that the new [GitHub Actions](https://github.com/features/actions) will let us auto-format pull requests and post comments with relevant linting information.
### Types of change
enhancement, code style
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2018-11-30 16:03:03 +00:00
|
|
|
"eng",
|
|
|
|
"etc",
|
|
|
|
"exkl",
|
2019-02-07 19:54:07 +00:00
|
|
|
"ev",
|
|
|
|
"f.",
|
💫 Tidy up and auto-format .py files (#2983)
<!--- Provide a general summary of your changes in the title. -->
## Description
- [x] Use [`black`](https://github.com/ambv/black) to auto-format all `.py` files.
- [x] Update flake8 config to exclude very large files (lemmatization tables etc.)
- [x] Update code to be compatible with flake8 rules
- [x] Fix various small bugs, inconsistencies and messy stuff in the language data
- [x] Update docs to explain new code style (`black`, `flake8`, when to use `# fmt: off` and `# fmt: on` and what `# noqa` means)
Once #2932 is merged, which auto-formats and tidies up the CLI, we'll be able to run `flake8 spacy` actually get meaningful results.
At the moment, the code style and linting isn't applied automatically, but I'm hoping that the new [GitHub Actions](https://github.com/features/actions) will let us auto-format pull requests and post comments with relevant linting information.
### Types of change
enhancement, code style
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2018-11-30 16:03:03 +00:00
|
|
|
"f.d",
|
|
|
|
"f.kr",
|
|
|
|
"f.n",
|
|
|
|
"f.ö",
|
|
|
|
"fid",
|
|
|
|
"fig",
|
|
|
|
"forts",
|
|
|
|
"fr.o.m",
|
|
|
|
"förf",
|
|
|
|
"inkl",
|
2019-02-07 19:54:07 +00:00
|
|
|
"iofs",
|
|
|
|
"jur.",
|
💫 Tidy up and auto-format .py files (#2983)
<!--- Provide a general summary of your changes in the title. -->
## Description
- [x] Use [`black`](https://github.com/ambv/black) to auto-format all `.py` files.
- [x] Update flake8 config to exclude very large files (lemmatization tables etc.)
- [x] Update code to be compatible with flake8 rules
- [x] Fix various small bugs, inconsistencies and messy stuff in the language data
- [x] Update docs to explain new code style (`black`, `flake8`, when to use `# fmt: off` and `# fmt: on` and what `# noqa` means)
Once #2932 is merged, which auto-formats and tidies up the CLI, we'll be able to run `flake8 spacy` actually get meaningful results.
At the moment, the code style and linting isn't applied automatically, but I'm hoping that the new [GitHub Actions](https://github.com/features/actions) will let us auto-format pull requests and post comments with relevant linting information.
### Types of change
enhancement, code style
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2018-11-30 16:03:03 +00:00
|
|
|
"kap",
|
|
|
|
"kl",
|
2019-02-07 19:54:07 +00:00
|
|
|
"kor.",
|
💫 Tidy up and auto-format .py files (#2983)
<!--- Provide a general summary of your changes in the title. -->
## Description
- [x] Use [`black`](https://github.com/ambv/black) to auto-format all `.py` files.
- [x] Update flake8 config to exclude very large files (lemmatization tables etc.)
- [x] Update code to be compatible with flake8 rules
- [x] Fix various small bugs, inconsistencies and messy stuff in the language data
- [x] Update docs to explain new code style (`black`, `flake8`, when to use `# fmt: off` and `# fmt: on` and what `# noqa` means)
Once #2932 is merged, which auto-formats and tidies up the CLI, we'll be able to run `flake8 spacy` actually get meaningful results.
At the moment, the code style and linting isn't applied automatically, but I'm hoping that the new [GitHub Actions](https://github.com/features/actions) will let us auto-format pull requests and post comments with relevant linting information.
### Types of change
enhancement, code style
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2018-11-30 16:03:03 +00:00
|
|
|
"kr",
|
|
|
|
"kungl",
|
|
|
|
"lat",
|
|
|
|
"m.a.o",
|
|
|
|
"m.fl",
|
|
|
|
"m.m",
|
|
|
|
"max",
|
|
|
|
"milj",
|
2019-02-07 19:54:07 +00:00
|
|
|
"min.",
|
💫 Tidy up and auto-format .py files (#2983)
<!--- Provide a general summary of your changes in the title. -->
## Description
- [x] Use [`black`](https://github.com/ambv/black) to auto-format all `.py` files.
- [x] Update flake8 config to exclude very large files (lemmatization tables etc.)
- [x] Update code to be compatible with flake8 rules
- [x] Fix various small bugs, inconsistencies and messy stuff in the language data
- [x] Update docs to explain new code style (`black`, `flake8`, when to use `# fmt: off` and `# fmt: on` and what `# noqa` means)
Once #2932 is merged, which auto-formats and tidies up the CLI, we'll be able to run `flake8 spacy` actually get meaningful results.
At the moment, the code style and linting isn't applied automatically, but I'm hoping that the new [GitHub Actions](https://github.com/features/actions) will let us auto-format pull requests and post comments with relevant linting information.
### Types of change
enhancement, code style
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2018-11-30 16:03:03 +00:00
|
|
|
"mos",
|
|
|
|
"mt",
|
2019-02-07 19:54:07 +00:00
|
|
|
"mvh",
|
💫 Tidy up and auto-format .py files (#2983)
<!--- Provide a general summary of your changes in the title. -->
## Description
- [x] Use [`black`](https://github.com/ambv/black) to auto-format all `.py` files.
- [x] Update flake8 config to exclude very large files (lemmatization tables etc.)
- [x] Update code to be compatible with flake8 rules
- [x] Fix various small bugs, inconsistencies and messy stuff in the language data
- [x] Update docs to explain new code style (`black`, `flake8`, when to use `# fmt: off` and `# fmt: on` and what `# noqa` means)
Once #2932 is merged, which auto-formats and tidies up the CLI, we'll be able to run `flake8 spacy` actually get meaningful results.
At the moment, the code style and linting isn't applied automatically, but I'm hoping that the new [GitHub Actions](https://github.com/features/actions) will let us auto-format pull requests and post comments with relevant linting information.
### Types of change
enhancement, code style
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2018-11-30 16:03:03 +00:00
|
|
|
"o.d",
|
|
|
|
"o.s.v",
|
|
|
|
"obs",
|
|
|
|
"osv",
|
|
|
|
"p.g.a",
|
|
|
|
"proc",
|
|
|
|
"prof",
|
|
|
|
"ref",
|
|
|
|
"resp",
|
|
|
|
"s.a.s",
|
|
|
|
"s.k",
|
|
|
|
"s.t",
|
|
|
|
"sid",
|
|
|
|
"t.ex",
|
|
|
|
"t.h",
|
|
|
|
"t.o.m",
|
|
|
|
"t.v",
|
|
|
|
"tel",
|
2019-02-07 19:54:07 +00:00
|
|
|
"ung.",
|
💫 Tidy up and auto-format .py files (#2983)
<!--- Provide a general summary of your changes in the title. -->
## Description
- [x] Use [`black`](https://github.com/ambv/black) to auto-format all `.py` files.
- [x] Update flake8 config to exclude very large files (lemmatization tables etc.)
- [x] Update code to be compatible with flake8 rules
- [x] Fix various small bugs, inconsistencies and messy stuff in the language data
- [x] Update docs to explain new code style (`black`, `flake8`, when to use `# fmt: off` and `# fmt: on` and what `# noqa` means)
Once #2932 is merged, which auto-formats and tidies up the CLI, we'll be able to run `flake8 spacy` actually get meaningful results.
At the moment, the code style and linting isn't applied automatically, but I'm hoping that the new [GitHub Actions](https://github.com/features/actions) will let us auto-format pull requests and post comments with relevant linting information.
### Types of change
enhancement, code style
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2018-11-30 16:03:03 +00:00
|
|
|
"vol",
|
2019-02-07 19:54:07 +00:00
|
|
|
"v.",
|
💫 Tidy up and auto-format .py files (#2983)
<!--- Provide a general summary of your changes in the title. -->
## Description
- [x] Use [`black`](https://github.com/ambv/black) to auto-format all `.py` files.
- [x] Update flake8 config to exclude very large files (lemmatization tables etc.)
- [x] Update code to be compatible with flake8 rules
- [x] Fix various small bugs, inconsistencies and messy stuff in the language data
- [x] Update docs to explain new code style (`black`, `flake8`, when to use `# fmt: off` and `# fmt: on` and what `# noqa` means)
Once #2932 is merged, which auto-formats and tidies up the CLI, we'll be able to run `flake8 spacy` actually get meaningful results.
At the moment, the code style and linting isn't applied automatically, but I'm hoping that the new [GitHub Actions](https://github.com/features/actions) will let us auto-format pull requests and post comments with relevant linting information.
### Types of change
enhancement, code style
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2018-11-30 16:03:03 +00:00
|
|
|
"äv",
|
|
|
|
"övers",
|
2018-08-07 11:53:17 +00:00
|
|
|
]
|
2019-01-16 12:45:50 +00:00
|
|
|
|
|
|
|
# Add abbreviation for trailing punctuation too. If the abbreviation already has a trailing punctuation - skip it.
|
|
|
|
for abbr in ABBREVIATIONS:
|
2019-02-08 13:14:49 +00:00
|
|
|
if not abbr.endswith("."):
|
2019-01-16 12:45:50 +00:00
|
|
|
ABBREVIATIONS.append(abbr + ".")
|
2018-08-07 11:53:17 +00:00
|
|
|
|
|
|
|
for orth in ABBREVIATIONS:
|
2017-05-08 13:54:29 +00:00
|
|
|
_exc[orth] = [{ORTH: orth}]
|
2019-01-16 12:45:50 +00:00
|
|
|
capitalized = orth.capitalize()
|
|
|
|
_exc[capitalized] = [{ORTH: capitalized}]
|
2017-02-05 10:42:52 +00:00
|
|
|
|
2018-08-05 12:14:30 +00:00
|
|
|
# Sentences ending in "i." (as in "... peka i."), "m." (as in "...än 2000 m."),
|
|
|
|
# should be tokenized as two separate tokens.
|
|
|
|
for orth in ["i", "m"]:
|
2020-07-25 11:00:49 +00:00
|
|
|
_exc[orth + "."] = [{ORTH: orth, NORM: orth}, {ORTH: "."}]
|
2017-02-05 10:42:52 +00:00
|
|
|
|
2020-07-22 20:18:46 +00:00
|
|
|
TOKENIZER_EXCEPTIONS = update_exc(BASE_EXCEPTIONS, _exc)
|