Skip to content

Commit 43bae73

Browse files
committed
Docs: Minor docs tweaks for better compatibility with numpydoc.
1 parent 3dbb5b0 commit 43bae73

File tree

6 files changed

+13
-10
lines changed

6 files changed

+13
-10
lines changed

docs/source/conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
"myst_parser",
2727
]
2828

29+
numpydoc_xref_param_type = True
30+
numpydoc_class_members_toctree = False
31+
2932
templates_path = ["_templates"]
3033
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
3134

ingredient_parser/_common.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131

3232
def consume(iterator: Iterator, n: int | None) -> None:
33-
"""Advance the iterator n-steps ahead. If n is none, consume entirely.
33+
"""Advance the `iterator` n-steps ahead. If `n` is none, consume entirely.
3434
3535
See consume from https://docs.python.org/3/library/itertools.html#itertools-recipes
3636
@@ -126,7 +126,7 @@ def download_nltk_resources() -> None:
126126

127127

128128
def is_float(value: str) -> bool:
129-
"""Check if the value can be converted to a float.
129+
"""Check if `value` can be converted to a float.
130130
131131
Parameters
132132
----------
@@ -157,7 +157,7 @@ def is_float(value: str) -> bool:
157157

158158

159159
def is_range(value: str) -> bool:
160-
"""Check if the value is a range e.g. 100-200.
160+
"""Check if `value` is a range e.g. 100-200.
161161
162162
Parameters
163163
----------

ingredient_parser/dataclasses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ class FoundationFood:
323323
Confidence of the match, between 0 and 1.
324324
fdc_id : int
325325
ID of the FDC database entry.
326-
category: str
326+
category : str
327327
Category of FDC database entry.
328328
data_type : str
329329
Food Data Central data set the entry belongs to.

ingredient_parser/en/_foundationfoods.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ def get_fuzzy_matcher() -> FuzzyEmbeddingMatcher:
701701

702702

703703
def normalise_spelling(tokens: list[str]) -> list[str]:
704-
"""Normalise spelling in tokens to standard spellings used in FDC ingredient
704+
"""Normalise spelling in `tokens` to standard spellings used in FDC ingredient
705705
descriptions.
706706
707707
This also include subtitution of certain ingredients to use the FDC version e.g.

ingredient_parser/en/_structure_features.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ def detect_phrases(self, tokenized_sentence: list[Token]) -> list[list[int]]:
121121

122122
text_pos = [(token.text, token.pos_tag) for token in self.tokenized_sentence]
123123
parsed = self.mip_parser.parse(text_pos)
124-
for subtree in parsed.subtrees(filter=lambda t: t.label() in ["EMIP", "MIP"]):
125-
indices = self._get_subtree_indices(parsed, subtree)
124+
for subtree in parsed.subtrees(filter=lambda t: t.label() in ["EMIP", "MIP"]): # type: ignore
125+
indices = self._get_subtree_indices(parsed, subtree) # type: ignore
126126
# If the conjunction is not "or", skip
127127
if self._cc_is_not_or(text_pos, indices):
128128
continue
@@ -172,8 +172,8 @@ def detect_sentences_splits(self, tokenized_sentence: list[Token]) -> list[int]:
172172

173173
text_pos.append((t.feat_text, pos))
174174
parsed = self.compound_parser.parse(text_pos)
175-
for subtree in parsed.subtrees(filter=lambda t: t.label() == "CS"):
176-
indices = self._get_subtree_indices(parsed, subtree)
175+
for subtree in parsed.subtrees(filter=lambda t: t.label() == "CS"): # type: ignore
176+
indices = self._get_subtree_indices(parsed, subtree) # type: ignore
177177
# If the conjunction is not "or", skip
178178
if self._cc_is_not_or(text_pos, indices):
179179
continue

ingredient_parser/en/preprocess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ def _token_features(self, token: Token) -> dict[str, str | bool]:
10681068
return features
10691069

10701070
def sentence_features(self) -> list[dict[str, str | bool]]:
1071-
"""Return features for all tokens in sentence.
1071+
"""Return dict of features for each token in sentence.
10721072
10731073
Returns
10741074
-------

0 commit comments

Comments
 (0)