Skip to content

Commit 276f182

Browse files
author
Ben King
committed
Use relative imports
1 parent 3fb4d51 commit 276f182

File tree

2 files changed

+15
-26
lines changed

2 files changed

+15
-26
lines changed

silnlp/common/postprocesser.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ def _detect_quote_convention(self, project_name: str) -> QuoteConvention:
187187
raise NoDetectedQuoteConventionException(project_name)
188188
LOGGER.info(
189189
f'Detected quote convention for project "{project_name}" is '
190-
+ '"{quote_convention_analysis.best_quote_convention.name}" with score '
191-
+ "{quote_convention_analysis.best_quote_convention_score:.2f}."
190+
+ f'"{quote_convention_analysis.best_quote_convention.name}" with score '
191+
+ f"{quote_convention_analysis.best_quote_convention_score:.2f}."
192192
)
193193
self._project_convention_cache[project_name] = quote_convention_analysis.best_quote_convention
194194

@@ -222,17 +222,7 @@ def _create_remark(self, best_chapter_strategies: List[QuotationMarkUpdateStrate
222222

223223
if len(processed_chapters) == 0:
224224
return self._NO_CHAPTERS_REMARK_SENTENCE
225-
return (
226-
self._REMARK_SENTENCE
227-
+ ", ".join(
228-
[
229-
str(chapter_num)
230-
for chapter_num, strategy in enumerate(best_chapter_strategies, 1)
231-
if strategy != QuotationMarkUpdateStrategy.SKIP
232-
]
233-
)
234-
+ "."
235-
)
225+
return self._REMARK_SENTENCE + ", ".join(processed_chapters) + "."
236226

237227
def postprocess_usfm(
238228
self,

silnlp/nmt/config.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,6 @@
1515
from machine.tokenization import LatinWordTokenizer
1616
from tqdm import tqdm
1717

18-
from silnlp.common.translator import TranslationGroup
19-
from silnlp.nmt.corpora import (
20-
BASIC_DATA_PROJECT,
21-
CorpusPair,
22-
DataFile,
23-
DataFileMapping,
24-
IsoPairInfo,
25-
get_data_file_pairs,
26-
get_parallel_corpus_size,
27-
get_terms_glosses_file_paths,
28-
parse_corpus_pairs,
29-
)
30-
3118
from ..alignment.config import get_aligner_name
3219
from ..alignment.utils import add_alignment_scores
3320
from ..common.corpus import (
@@ -45,8 +32,20 @@
4532
write_corpus,
4633
)
4734
from ..common.environment import SIL_NLP_ENV
35+
from ..common.translator import TranslationGroup
4836
from ..common.utils import NoiseMethod, Side, get_mt_exp_dir, set_seed
4937
from .augment import AugmentMethod
38+
from .corpora import (
39+
BASIC_DATA_PROJECT,
40+
CorpusPair,
41+
DataFile,
42+
DataFileMapping,
43+
IsoPairInfo,
44+
get_data_file_pairs,
45+
get_parallel_corpus_size,
46+
get_terms_glosses_file_paths,
47+
parse_corpus_pairs,
48+
)
5049
from .tokenizer import Tokenizer
5150

5251
LOGGER = logging.getLogger(__package__ + ".config")

0 commit comments

Comments
 (0)