Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
oktaal committed Mar 14, 2024
1 parent 3333b35 commit adedb5d
Show file tree
Hide file tree
Showing 59 changed files with 10,040 additions and 5,816 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
pip install -r requirements.txt
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 mwe_query --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 tests --count --select=E9,F63,F7,F82 --show-source --statistics
Expand All @@ -38,11 +38,13 @@ jobs:
flake8 mwe_query --count --exit-zero --max-complexity=22 --max-line-length=261 --statistics
# TODO:
# flake8 tests --count --exit-zero --max-complexity=22 --max-line-length=261 --statistics
- name: Check typing
run: |
pip install mypy
pip install lxml-stubs
mypy **/*.py
# TODO:
# - name: Check typing
# run: |
# pip install mypy
# pip install pandas-stubs
# pip install lxml-stubs
# mypy **/*.py
- name: Run unit tests
run: |
python -m unittest discover tests/
Expand Down
261 changes: 182 additions & 79 deletions mwe_query/adpositions.py
Original file line number Diff line number Diff line change
@@ -1,103 +1,206 @@
# list of Dutch circumpositions
circumpositions = [
('aan', 'toe'),
('achter', 'aan'),
('bij', 'af'),
('bij', 'na'),
('bij', 'thuis'),
('bij', 'vandaan'),
('boven', 'uit'),
('buiten', 'om'),
('door', 'heen'),
('met', 'mee'),
('naar', 'toe'),
('om', 'heen'),
('onder', 'door'),
('onder', ' uit'),
('onder', 'vandaan'),
('op', 'af'),
('op', 'na'),
('over', 'heen'),
('tegen', 'aan'),
('tegen', 'in'),
('tegen', 'op'),
('tot', 'toe'),
('tussen', 'door'),
('tussen', 'in'),
('uit', 'vandaan'),
('van', 'af'),
('van', 'uit'),
('van', 'vandaan'),
('voor', 'aan'),
('voor', 'langs'),
('voor', 'uit')
("aan", "toe"),
("achter", "aan"),
("bij", "af"),
("bij", "na"),
("bij", "thuis"),
("bij", "vandaan"),
("boven", "uit"),
("buiten", "om"),
("door", "heen"),
("met", "mee"),
("naar", "toe"),
("om", "heen"),
("onder", "door"),
("onder", " uit"),
("onder", "vandaan"),
("op", "af"),
("op", "na"),
("over", "heen"),
("tegen", "aan"),
("tegen", "in"),
("tegen", "op"),
("tot", "toe"),
("tussen", "door"),
("tussen", "in"),
("uit", "vandaan"),
("van", "af"),
("van", "uit"),
("van", "vandaan"),
("voor", "aan"),
("voor", "langs"),
("voor", "uit"),
]

vzazindex = {vz+az: (vz, az) for (vz, az) in circumpositions}
vzazindex = {vz + az: (vz, az) for (vz, az) in circumpositions}

# list of prepositions that can also occur (posssibly in a variant) as a separable particle,
# e.g 'aan', 'met' (because of 'mee';, but not 'van'

vzandprts = {
'aan',
'achter',
'af',
'bij',
'binnen',
'buiten',
'door',
'in',
'langs',
'mee',
'met',
'na',
'naar',
'om',
'onder',
'op',
'over',
'rond',
'tegen',
'toe',
'tot',
'uit',
'voor',
'voorbij',


"aan",
"achter",
"af",
"bij",
"binnen",
"buiten",
"door",
"in",
"langs",
"mee",
"met",
"na",
"naar",
"om",
"onder",
"op",
"over",
"rond",
"tegen",
"toe",
"tot",
"uit",
"voor",
"voorbij",
}

# Source e-ANS


informal_locative_prepositions = { 'op', 'aan', 'tegen', 'in', 'binnen', 'buiten', 'onder', 'boven', 'voor',
'achter', 'naast', 'tussen', 'halverwege', 'tegenover', 'bij', 'beneden'}

formal_locative_prepositions = {'nabij', 'te', 'benoorden', 'beoosten', 'bewesten', 'bezuiden'}
informal_directional_prepositions = {'van', 'uit', 'vanaf', 'vanuit', 'vanonder', 'door', 'om', 'over',
'langs', 'voorbij', 'via', 'rond', 'rondom', 'naar', 'tot', 'richting'}
informal_temporal_prepositions = {'na', 'sinds', 'tijdens'}
formal_temporal_prepositions = {'sedert', 'omstreeks', 'gedurende', 'hangende', 'staande', 'gaande'}
informal_other_prepositions = {'met', 'zonder', 'per', 'volgens', 'dankzij', 'ondanks', 'vanwege'}
formal_other_prepositions = {'blijkens', 'conform', 'gegeven', 'getuige', 'gezien', 'ingevolge', 'krachtens',
'luidens', 'middels', 'namens', 'naargelang', 'overeenkomstig', 'wegens',
'behoudens', 'bezijden', 'exclusief', 'niettegenstaande', 'ongeacht',
'onverminderd', 'uitgezonderd', 'aangaande', 'betreffende', 'inzake',
'jegens', 'nopens', 'omtrent', 'qua', 'benevens', 'inclusief', 'contra', 'versus', 'à'}
informal_locative_prepositions = {
"op",
"aan",
"tegen",
"in",
"binnen",
"buiten",
"onder",
"boven",
"voor",
"achter",
"naast",
"tussen",
"halverwege",
"tegenover",
"bij",
"beneden",
}

informalprepositions = informal_locative_prepositions.union(informal_temporal_prepositions, informal_other_prepositions)
formalprepositions = formal_locative_prepositions.union(formal_temporal_prepositions, formal_other_prepositions)
formal_locative_prepositions = {
"nabij",
"te",
"benoorden",
"beoosten",
"bewesten",
"bezuiden",
}
informal_directional_prepositions = {
"van",
"uit",
"vanaf",
"vanuit",
"vanonder",
"door",
"om",
"over",
"langs",
"voorbij",
"via",
"rond",
"rondom",
"naar",
"tot",
"richting",
}
informal_temporal_prepositions = {"na", "sinds", "tijdens"}
formal_temporal_prepositions = {
"sedert",
"omstreeks",
"gedurende",
"hangende",
"staande",
"gaande",
}
informal_other_prepositions = {
"met",
"zonder",
"per",
"volgens",
"dankzij",
"ondanks",
"vanwege",
}
formal_other_prepositions = {
"blijkens",
"conform",
"gegeven",
"getuige",
"gezien",
"ingevolge",
"krachtens",
"luidens",
"middels",
"namens",
"naargelang",
"overeenkomstig",
"wegens",
"behoudens",
"bezijden",
"exclusief",
"niettegenstaande",
"ongeacht",
"onverminderd",
"uitgezonderd",
"aangaande",
"betreffende",
"inzake",
"jegens",
"nopens",
"omtrent",
"qua",
"benevens",
"inclusief",
"contra",
"versus",
"à",
}

locative_prepositions = informal_locative_prepositions.union(formal_locative_prepositions)
temporal_prepositions = informal_temporal_prepositions.union(formal_temporal_prepositions)
informalprepositions = informal_locative_prepositions.union(
informal_temporal_prepositions, informal_other_prepositions
)
formalprepositions = formal_locative_prepositions.union(
formal_temporal_prepositions, formal_other_prepositions
)

locative_prepositions = informal_locative_prepositions.union(
formal_locative_prepositions
)
temporal_prepositions = informal_temporal_prepositions.union(
formal_temporal_prepositions
)
other_prepositions = informal_other_prepositions.union(formal_other_prepositions)

portmanteauprepositions = {'ter', 'ten'}
portmanteauprepositions = {"ter", "ten"}


allsimpleprepositions = locative_prepositions.union(temporal_prepositions, other_prepositions)
allsimpleprepositions = locative_prepositions.union(
temporal_prepositions, other_prepositions
)

allprepositions = allsimpleprepositions.union(portmanteauprepositions)


postpositions = {'in', 'binnen', 'op', 'uit', 'af', ' door', 'over', 'voorbij', 'langs', 'rond', 'om'}
postpositions = {
"in",
"binnen",
"op",
"uit",
"af",
" door",
"over",
"voorbij",
"langs",
"rond",
"om",
}
Loading

0 comments on commit adedb5d

Please sign in to comment.