From 2d9f7cfc5a59912c50a4900e1b3710bcbb9e2203 Mon Sep 17 00:00:00 2001 From: Sam Sloniker Date: Fri, 20 May 2022 17:22:37 -0700 Subject: [PATCH] Add blank lines before and after headings in README --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 45f01fb..2447c2f 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ # GPTC + General-purpose text classifier in Python GPTC provides both a CLI tool and a Python library. ## CLI Tool + ### Classifying text python -m gptc @@ -23,20 +25,28 @@ category:probability, ...}` to stdout. python -m gptc -c|--compile ## Library + ### `gptc.Classifier(model)` + Create a `Classifier` object using the given *compiled* model (as a dict, not JSON). + #### `Classifier.confidence(text)` + Classify `text`. Returns a dict of the format `{category: probability, category:probability, ...}` + #### `Classifier.classify(text)` + Classify `text`. Returns the category into which the text is placed (as a string), or `None` when it cannot classify the text. + ## `gptc.compile(raw_model)` Compile a raw model (as a list, not JSON) and return the compiled model (as a dict). ## Model format + This section explains the raw model format, which is how you should create and edit models. @@ -55,6 +65,7 @@ in any way these Python objects can be. However, it is recommended to store them in JSON format for compatibility with the command-line tool. ## Example model + An example model, which is designed to distinguish between texts written by Mark Twain and those written by William Shakespeare, is available in `models`. The raw model is in `models/raw.json`; the compiled model is in