Rename check to classify
This commit is contained in:
parent
1cbc4b311e
commit
7718941617
|
@ -15,7 +15,7 @@ If you want to use GPTC programmatically, use the library.
|
||||||
### `gptc.Classifier(model)`
|
### `gptc.Classifier(model)`
|
||||||
Create a `Classifier` object using the given model (as a Python list/dict, not
|
Create a `Classifier` object using the given model (as a Python list/dict, not
|
||||||
as JSON). If the model is raw (a list), it will print a big warning on stderr.
|
as JSON). If the model is raw (a list), it will print a big warning on stderr.
|
||||||
### `Classifier.check(text)`
|
### `Classifier.classify(text)`
|
||||||
Classify `text` with GPTC using the model used to instantiate the
|
Classify `text` with GPTC using the model used to instantiate the
|
||||||
`Classifier`. Returns the category into which the text is placed (as a
|
`Classifier`. Returns the category into which the text is placed (as a
|
||||||
string), or `'unknown'` when it cannot classify the text.
|
string), or `'unknown'` when it cannot classify the text.
|
||||||
|
|
|
@ -50,7 +50,7 @@ class Classifier:
|
||||||
print('This makes everything slow, because compiling models takes far longer than using them.', file=sys.stderr)
|
print('This makes everything slow, because compiling models takes far longer than using them.', file=sys.stderr)
|
||||||
self.warn = supress_uncompiled_model_warning
|
self.warn = supress_uncompiled_model_warning
|
||||||
|
|
||||||
def check(self, text):
|
def classify(self, text):
|
||||||
model = self.model
|
model = self.model
|
||||||
text = listify(text)
|
text = listify(text)
|
||||||
probs = {}
|
probs = {}
|
||||||
|
|
|
@ -22,4 +22,4 @@ else:
|
||||||
text = input('Text to analyse: ')
|
text = input('Text to analyse: ')
|
||||||
else:
|
else:
|
||||||
text = sys.stdin.read()
|
text = sys.stdin.read()
|
||||||
print(classifier.check(text))
|
print(classifier.classify(text))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user