Skip to content

Commit d2ff383

Browse files
author
Adrien Ball
authored
Merge pull request #83 from snipsco/develop
Release 0.11.1
2 parents ec22349 + 16cac95 commit d2ff383

File tree

4 files changed

+79
-73
lines changed

4 files changed

+79
-73
lines changed

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
include snips_nlu_metrics/__version__
2-
include README.md LICENSE
2+
include README.rst LICENSE
33
global-exclude __pycache__ *.py[cod]

README.md

Lines changed: 0 additions & 71 deletions
This file was deleted.

README.rst

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
Snips NLU Metrics
2+
=================
3+
4+
.. image:: https://travis-ci.org/snipsco/snips-nlu-metrics.svg?branch=master
5+
:target: https://travis-ci.org/snipsco/snips-nlu-metrics
6+
7+
Python package to compute metrics on a NLU/ASR parsing pipeline
8+
9+
Install
10+
-------
11+
12+
.. code-block:: console
13+
14+
pip install snips_nlu_metrics
15+
16+
17+
Pure NLU Metrics API
18+
--------------------
19+
20+
.. code-block:: python
21+
22+
from snips_nlu_metrics import (
23+
compute_train_test_nlu_metrics, compute_cross_val_nlu_metrics)
24+
from snips_nlu import SnipsNLUEngine as NLUTrainingEngine
25+
from snips_nlu_rust import NLUEngine as NLUInferenceEngine
26+
27+
28+
tt_metrics = compute_train_test_nlu_metrics(train_dataset="path/to/train_dataset.json",
29+
test_dataset="path/to/test_dataset.json",
30+
training_engine_class=NLUTrainingEngine,
31+
inference_engine_class=NLUInferenceEngine)
32+
33+
cv_metrics = compute_cross_val_nlu_metrics(dataset="path/to/dataset.json",
34+
training_engine_class=NLUTrainingEngine,
35+
inference_engine_class=NLUInferenceEngine,
36+
nb_folds=5)
37+
38+
End-to-End Metrics API
39+
----------------------
40+
41+
The metrics API lets you compute metrics on a full end-to-end ASR + NLU pipeline.
42+
To do that, you will need to implement an engine class that inherits or satisfy
43+
the API of the following ``Engine`` abstract class:
44+
45+
.. code-block:: python
46+
47+
from abc import ABCMeta, abstractmethod
48+
49+
class Engine(object):
50+
"""
51+
Abstract class which represents an engine that can be used in the metrics
52+
API. All engine classes must inherit from `Engine` or satisfy its API.
53+
"""
54+
__metaclass__ = ABCMeta
55+
56+
@abstractmethod
57+
def fit(self, dataset):
58+
pass
59+
60+
@abstractmethod
61+
def parse(self, text):
62+
pass
63+
64+
Here is how you can use the end-to-end metrics API, if you have a ``EndToEndEngine`` that inherits from ``Engine``:
65+
66+
.. code-block:: python
67+
68+
from snips_nlu_metrics import compute_train_test_metrics, compute_cross_val_metrics
69+
70+
71+
tt_metrics = compute_train_test_metrics(train_dataset="path/to/train_dataset.json",
72+
test_dataset="path/to/test_dataset.json",
73+
engine_class=EndToEndEngine)
74+
75+
cv_metrics = compute_cross_val_metrics(dataset="path/to/dataset.json",
76+
engine_class=EndToEndEngine,
77+
nb_folds=5)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
PACKAGE_NAME = "snips_nlu_metrics"
99
ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
1010
PACKAGE_PATH = os.path.join(ROOT_PATH, PACKAGE_NAME)
11-
README = os.path.join(ROOT_PATH, "README.md")
11+
README = os.path.join(ROOT_PATH, "README.rst")
1212
VERSION = "__version__"
1313

1414
with io.open(os.path.join(PACKAGE_PATH, VERSION)) as f:

0 commit comments

Comments
 (0)