Skip to content

Commit

Permalink
feat: Decouple parsing the taxonomy and writing the taxonomy to the d…
Browse files Browse the repository at this point in the history
…atabase (#317)

* refactor: mark private function with _

* refactor(parser): add type annotations and clean up code

* chore: use context manager to close session in tests

* chore: update neo4j and Makefile

* refactor: create parser specific directory

* refactor: start taxonomy_parser by copying parser file

* refactor: move logger to separate file

* refactor: remove unnecessary code for taxonomy parser

* feat: update TaxonomyParser to return taxonomy class

* feat: update parser to use taxonomy parser

* chore: update tests for new taxonomy parser
  • Loading branch information
eric-nguyen-cs authored Jan 17, 2024
1 parent c03cc5f commit 71b34be
Show file tree
Hide file tree
Showing 13 changed files with 865 additions and 756 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3.9"
services:
neo4j:
restart: ${RESTART_POLICY:-no}
image: neo4j:5.3.0-community
image: neo4j:5.14.0-community
ports:
# admin console
- "${NEO4J_ADMIN_EXPOSE:-127.0.0.1:7474}:7474"
Expand Down
2 changes: 1 addition & 1 deletion parser/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ quality:

tests:
cd .. && docker compose up -d neo4j
pytest .
poetry run pytest .
# we do not shutdown neo4j

checks: quality tests
2 changes: 1 addition & 1 deletion parser/openfoodfacts_taxonomy_parser/normalizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import unidecode


def normalizing(line, lang="default", char="-"):
def normalizing(line: str, lang="default", char="-"):
"""Normalize a string depending on the language code"""
line = unicodedata.normalize("NFC", line)

Expand Down
Loading

0 comments on commit 71b34be

Please sign in to comment.