Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move tokenizer/tokenizer.py inside diaparser #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion diaparser/parsers/biaffine_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from ..utils.logging import get_logger, progress_bar
from ..utils.metric import AttachmentMetric
from ..utils.transform import CoNLL
from tokenizer.tokenizer import Tokenizer
from ..tokenizer.tokenizer import Tokenizer

logger = get_logger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion diaparser/parsers/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import torch
import torch.distributed as dist
from .. import parsers
from tokenizer.tokenizer import Tokenizer
from ..tokenizer.tokenizer import Tokenizer
from ..catalog import select
from ..utils import Config, Dataset
from ..utils.field import Field, BertField
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions tokenizer/tokenizer.py → diaparser/tokenizer/tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ def __init__(self, lang, dir=os.path.expanduser('~/.cache/diaparser'), verbose=T
processors = ','.join(avail_preprocessors)
try:
# get Stanza resource.json which is needed by stanza.Pipeline().
stanza.download(lang='', dir=dir)
stanza.download(lang='', model_dir=dir, verbose=verbose)
except:
pass # discard exception for unknown lang=''
else:
cached_paths = {}
processors='tokenize'
stanza.download(lang, dir=dir, processors=processors, verbose=verbose)
stanza.download(lang, model_dir=dir, processors=processors, verbose=verbose)
try:
stanza.download(lang, dir=dir, processors='mwt', verbose=verbose)
stanza.download(lang, model_dir=dir, processors='mwt', verbose=verbose)
processors += ',mwt'
except:
pass
Expand Down
2 changes: 1 addition & 1 deletion diaparser/utils/corpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from collections.abc import Iterable
from .field import Field

from tokenizer.tokenizer import Tokenizer
from ..tokenizer.tokenizer import Tokenizer

import sys
import math
Expand Down
2 changes: 1 addition & 1 deletion tests/test_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import unittest
import io

from tokenizer.tokenizer import Tokenizer
from diaparser.tokenizer.tokenizer import Tokenizer

class TestTokenizer(unittest.TestCase):

Expand Down