Commit 69ac95bb authored by militarpancho's avatar militarpancho
Browse files

Added example plugin in docs. #34

parent 0f8d1dff
......@@ -98,7 +98,7 @@ The value may be any valid JSON-LD dictionary.
For simplicity, senpy includes a series of models by default in the ``senpy.models`` module.
Example plugin
Example plugin
In this section, we will implement a basic sentiment analysis plugin.
......@@ -113,7 +113,7 @@ The definition file would look like this:
module: helloworld
version: 0.0
threshold: 10
description: Hello World
Now, in a file named ````:
......@@ -122,11 +122,11 @@ Now, in a file named ````:
#!/bin/env python
from senpy.plugins import SenpyPlugin
from senpy.plugins import AnalysisPlugin
from senpy.models import Sentiment
class HelloWorld(SenpyPlugin):
class HelloWorld(AnalysisPlugin):
def analyse_entry(entry, params):
'''Basically do nothing with each entry'''
......@@ -139,6 +139,8 @@ Now, in a file named ````:
yield entry
A repository with the code of an example plugin adding extra data is available `here <>`__
......@@ -166,7 +168,7 @@ Training a classifier can be time time consuming. To avoid running the training
from senpy.plugins import ShelfMixin, SenpyPlugin
class MyPlugin(ShelfMixin, SenpyPlugin):
class MyPlugin(ShelfMixin, AnalysisPlugin):
def train(self):
''' Code to train the classifier
......@@ -277,7 +279,6 @@ Additionally, with the ``--pdb`` option you will be dropped into a pdb post mort
senpy --pdb
Where can I find more code examples?
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment