diff --git a/README.md b/README.md index 6eca8bd3f077a614127f6e6963f4351699074583..a34e9eda350bd5b185e77c97cc36b48a5fa677b7 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,10 @@ | :------: | :-----------------------------------------------------------------------: | :---------: | :---------: | :-----------: | | 内容理解 | [Text-Classifcation](models/contentunderstanding/classification/model.py) | ✓ | x | ✓ | | 内容理解 | [TagSpace](models/contentunderstanding/tagspace/model.py) | ✓ | x | ✓ | - | 召回 | [DSSM](models/match/dssm/model.py) | ✓ | x | ✓ | - | 召回 | [MultiView-Simnet](models/match/multiview-simnet/model.py) | ✓ | x | ✓ | + | 匹配 | [DSSM](models/match/dssm/model.py) | ✓ | x | ✓ | + | 匹配 | [MultiView-Simnet](models/match/multiview-simnet/model.py) | ✓ | x | ✓ | | 召回 | [TDM](models/treebased/tdm/model.py) | ✓ | x | ✓ | + | 召回 | [fasttext](models/recall/fasttext/model.py) | ✓ | x | x | | 召回 | [Word2Vec](models/recall/word2vec/model.py) | ✓ | x | ✓ | | 召回 | [SSR](models/recall/ssr/model.py) | ✓ | ✓ | ✓ | | 召回 | [Gru4Rec](models/recall/gru4rec/model.py) | ✓ | ✓ | ✓ | diff --git a/core/utils/validation.py b/core/utils/validation.py index 836b3373ffe7dec9fecb4fea1a9a3c92e63fe719..43c21d3e12d2ca84246e1d298b296c8eb5e76868 100644 --- a/core/utils/validation.py +++ b/core/utils/validation.py @@ -16,11 +16,10 @@ from paddlerec.core.utils import envs class ValueFormat: - def __init__(self, type, value, value_handler): - self.type = type + def __init__(self, value_type, value, value_handler): + self.value_type = value_type self.value = value self.value_handler = value_handler - self.help = help def is_valid(self, name, value): ret = self.is_type_valid(name, value) @@ -31,24 +30,24 @@ class ValueFormat: return ret def is_type_valid(self, name, value): - if self.type == "int": + if self.value_type == "int": if not isinstance(value, int): print("\nattr {} should be int, but {} now\n".format( - name, self.type)) + name, self.value_type)) return False return True - elif self.type == "str": + elif self.value_type == "str": if not isinstance(value, str): print("\nattr {} should be str, but {} now\n".format( - name, self.type)) + name, self.value_type)) return False return True - elif self.type == "strs": + elif self.value_type == "strs": if not isinstance(value, list): print("\nattr {} should be list(str), but {} now\n".format( - name, self.type)) + name, self.value_type)) return False for v in value: if not isinstance(v, str): @@ -57,10 +56,10 @@ class ValueFormat: return False return True - elif self.type == "ints": + elif self.value_type == "ints": if not isinstance(value, list): print("\nattr {} should be list(int), but {} now\n".format( - name, self.type)) + name, self.value_type)) return False for v in value: if not isinstance(v, int):