Skip to content

Commit

Permalink
Merge pull request #50 from Roboy/salt-march
Browse files Browse the repository at this point in the history
Ravestate v0.4.0
  • Loading branch information
josephbirkner authored Jan 29, 2019
2 parents 6e3d268 + 34cd4bf commit 4cb44bf
Show file tree
Hide file tree
Showing 72 changed files with 2,101 additions and 888 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ _build/*
ros2/build
ros2/install
ros2/log
venv/*
mkdocs.yml
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@ _ _ / /\/ /_/ /\ \/ / /_/ /\__, / / /_/ / / /_/ /

Ravestate is a reactive library for real-time natural language dialog systems.

## Dependencies

### portaudio on macOS

In order to install PyAudio with pip, you need to install portaudio first using:

`brew install portaudio`

## Installation

### Via PIP
Expand Down Expand Up @@ -101,9 +93,11 @@ If you have installed the dependencies from ``requirements-dev.txt``,
generate the docs by running this command at project root:

```bash
export PYTHONPATH=$PYTHONPATH:$(pwd)/modules
git rm -rf docs
rm -rf _build docs
pydocmd build
git add docs/*
```

The structure and content of the docs are defined in the file ``pydocmd.yml``.
5 changes: 4 additions & 1 deletion config/generic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@
---
module: core
config:
tickrate: 5
tickrate: 10
import:
- ravestate_interloc
- ravestate_conio
- ravestate_wildtalk
- ravestate_nlp
- ravestate_hibye
- ravestate_idle
- ravestate_fillers
ros2-node-name: "ros2-node-name"

---
module: genqa
Expand Down
9 changes: 9 additions & 0 deletions config/roboy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ config:
- ravestate_hibye
- ravestate_roboyqa
- ravestate_genqa
- ravestate_idle
- ravestate_akinator
# TODO: Fillers sometimes overwrite good responses by race condition.
# - ravestate_fillers

---
module: genqa
Expand All @@ -36,3 +40,8 @@ config:
module: roboyqa
config:
roboy_node_id: 356

---
module: akinator
config:
certainty_percentage: 90
59 changes: 44 additions & 15 deletions docs/context/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,22 @@

<h1 id="ravestate.context">ravestate.context</h1>

<h2 id="ravestate.context.startup">startup</h2>

<pre><code class="python">startup(**kwargs) -&gt; ravestate.constraint.Signal
</code></pre>

<p>Obtain the startup signal, which is fired once when <code>Context.run()</code> is executed.<br>
<strong>Hint:</strong> All key-word arguments of <code>constraint.s</code>(...)
(<code>min_age</code>, <code>max_age</code>, <code>detached</code>) are supported.</p>
<h2 id="ravestate.context.shutdown">shutdown</h2>

<pre><code class="python">shutdown(**kwargs) -&gt; ravestate.constraint.Signal
</code></pre>

<p>Obtain the shutdown signal, which is fired once when <code>Context.shutdown()</code> is called.<br>
<strong>Hint:</strong> All key-word arguments of <code>constraint.s</code>(...)
(<code>min_age</code>, <code>max_age</code>, <code>detached</code>) are supported.</p>
<h2 id="ravestate.context.Context">Context</h2>

<pre><code class="python">Context(self, *arguments)
Expand All @@ -131,8 +147,8 @@ <h3 id="ravestate.context.Context.emit">emit</h3>
<pre><code class="python">Context.emit(self, signal: ravestate.constraint.Signal, parents: Set[ravestate.spike.Spike] = None, wipe: bool = False) -&gt; None
</code></pre>

<p>Emit a signal to the signal processing loop. Note:
The signal will only be processed if run() has been called!</p>
<p>Emit a signal to the signal processing loop. <em>Note:</em>
The signal will only be processed if <code>run()</code> has been called!</p>
<ul>
<li>
<p><code>signal</code>: The signal to be emitted.</p>
Expand All @@ -141,7 +157,7 @@ <h3 id="ravestate.context.Context.emit">emit</h3>
<p><code>parents</code>: The signal's parents, if it is supposed to be integrated into a causal group.</p>
</li>
<li>
<p><code>wipe</code>: Boolean to control, whether wipe(signal) should be called
<p><code>wipe</code>: Boolean to control, whether <code>wipe</code>(signal) should be called
before the new spike is created.</p>
</li>
</ul>
Expand Down Expand Up @@ -252,7 +268,9 @@ <h3 id="ravestate.context.Context.lowest_upper_bound_eta">lowest_upper_bound_eta
</code></pre>

<p>Called by activation when it is pressured to resign. The activation wants
to know the earliest ETA of one of it's remaining required constraints.</p>
to know the earliest ETA of one of it's remaining required constraints.
Also called by constraint completion algorithm, to figure out the maximum
age for a completed constraint.</p>
<ul>
<li><code>signals</code>: The signals, whose ETA will be calculated, and among the
results the minimum ETA will be returned.</li>
Expand Down Expand Up @@ -326,12 +344,6 @@ <h2 id="ravestate.spike.Spike">Spike</h2>
<p>This class encapsulates a single spike, to track ... <br>
... it's consumption for different output properties (through <code>CausalGroup</code>). <br>
... it's offspring instances (causal group -&gt; spikes caused by this spike)</p>
<h3 id="ravestate.spike.Spike.name">name</h3>

<pre><code class="python">Spike.name(self) -&gt; str
</code></pre>

<p>Returns the name of this spike's signal.</p>
<h3 id="ravestate.spike.Spike.causal_group">causal_group</h3>

<pre><code class="python">Spike.causal_group(self) -&gt; ravestate.causal.CausalGroup
Expand Down Expand Up @@ -399,6 +411,12 @@ <h3 id="ravestate.spike.Spike.offspring">offspring</h3>

<p>Recursively yields this spike's offspring and it's children's offspring.</p>
<p><strong>Returns:</strong> All of this spike's offspring spikes.</p>
<h3 id="ravestate.spike.Spike.is_wiped">is_wiped</h3>

<pre><code class="python">Spike.is_wiped(self)
</code></pre>

<p>Check, whether this spike has been wiped, and should therefore not be acquired anymore.</p>
<h1 id="ravestate.activation">ravestate.activation</h1>

<h2 id="ravestate.activation.Activation">Activation</h2>
Expand All @@ -425,7 +443,7 @@ <h3 id="ravestate.activation.Activation.specificity">specificity</h3>
which in turn is calculated as one over the signal's subscriber count.</p>
<h3 id="ravestate.activation.Activation.dereference">dereference</h3>

<pre><code class="python">Activation.dereference(self, *, spike: Union[ravestate.iactivation.ISpike, NoneType] = None, reacquire: bool = False, reject: bool = False) -&gt; None
<pre><code class="python">Activation.dereference(self, *, spike: Union[ravestate.iactivation.ISpike, NoneType] = None, reacquire: bool = False, reject: bool = False, pressured: bool = False) -&gt; None
</code></pre>

<p>Notify the activation, that a single or all spike(s) are not available
Expand All @@ -434,7 +452,7 @@ <h3 id="ravestate.activation.Activation.dereference">dereference</h3>
... context when a state is deleted. <br>
... causal group, when a referenced signal was consumed for a required property. <br>
... causal group, when a referenced signal was wiped. <br>
... this activation (with reacquire=True), if it gives in to activation pressure.</p>
... this activation (with reacquire=True and pressured=True), if it gives in to activation pressure.</p>
<ul>
<li>
<p><code>spike</code>: The spike that should be forgotten by the activation, or
Expand All @@ -449,6 +467,10 @@ <h3 id="ravestate.activation.Activation.dereference">dereference</h3>
<p><code>reject</code>: Flag which controls, whether de-referenced spikes
should be explicitely rejected through their causal groups.</p>
</li>
<li>
<p><code>pressured</code>: Flag which controls, whether de-referencing should only occur
for spikes of causal groups in the pressuring_causal_groups set.</p>
</li>
</ul>
<h3 id="ravestate.activation.Activation.acquire">acquire</h3>

Expand All @@ -474,13 +496,16 @@ <h3 id="ravestate.activation.Activation.secs_to_ticks">secs_to_ticks</h3>
<p><strong>Returns:</strong> An integer tick count.</p>
<h3 id="ravestate.activation.Activation.pressure">pressure</h3>

<pre><code class="python">Activation.pressure(self)
<pre><code class="python">Activation.pressure(self, give_me_up: ravestate.iactivation.ICausalGroup)
</code></pre>

<p>Called by CausalGroup, to pressure the activation to
make a decision on whether it is going to retain a reference
to the given spike, given that there is a lower-
specificity activation which is ready to run.</p>
<ul>
<li><code>give_me_up</code>: Causal group that wishes to be de-referenced by this activation.</li>
</ul>
<h3 id="ravestate.activation.Activation.spiky">spiky</h3>

<pre><code class="python">Activation.spiky(self) -&gt; bool
Expand Down Expand Up @@ -522,7 +547,7 @@ <h3 id="ravestate.causal.CausalGroup.merge">merge</h3>
Afterwards, other's member objects will be set to this's.</p>
<h3 id="ravestate.causal.CausalGroup.acquired">acquired</h3>

<pre><code class="python">CausalGroup.acquired(self, spike: 'ISpike', acquired_by: ravestate.iactivation.IActivation) -&gt; bool
<pre><code class="python">CausalGroup.acquired(self, spike: 'ISpike', acquired_by: ravestate.iactivation.IActivation, detached: bool) -&gt; bool
</code></pre>

<p>Called by Activation to notify the causal group, that
Expand All @@ -536,6 +561,10 @@ <h3 id="ravestate.causal.CausalGroup.acquired">acquired</h3>
<p><code>acquired_by</code>: State activation instance,
which is interested in this property.</p>
</li>
<li>
<p><code>detached</code>: Tells the causal group, whether the reference is detached,
and should therefore receive special treatment.</p>
</li>
</ul>
<p><strong>Returns:</strong> Returns True if all of the acquiring's write-props are
free, and the group now refs. the activation, False otherwise.</p>
Expand All @@ -547,7 +576,7 @@ <h3 id="ravestate.causal.CausalGroup.rejected">rejected</h3>
<p>Called by a state activation, to notify the group that a member spike
is no longer being referenced for the given state's write props.
This may be because ... <br>
... the state activation auto-eliminated. (reason=0) <br>
... the state activation's dereference function was called. (reason=0) <br>
... the spike got too old. (reason=1) <br>
... the activation is happening and dereferencing it's spikes. (reason=2)</p>
<ul>
Expand Down
21 changes: 6 additions & 15 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,6 @@
<li class="toctree-l2"><a href="#about">About</a></li>


<li class="toctree-l2"><a href="#dependencies">Dependencies</a></li>

<ul>

<li><a class="toctree-l3" href="#portaudio-on-macos">portaudio on macOS</a></li>

</ul>


<li class="toctree-l2"><a href="#installation">Installation</a></li>

<ul>
Expand Down Expand Up @@ -169,10 +160,6 @@

<h2 id="about">About</h2>
<p>Ravestate is a reactive library for real-time natural language dialog systems.</p>
<h2 id="dependencies">Dependencies</h2>
<h3 id="portaudio-on-macos">portaudio on macOS</h3>
<p>In order to install PyAudio with pip, you need to install portaudio first using:</p>
<p><code>brew install portaudio</code></p>
<h2 id="installation">Installation</h2>
<h3 id="via-pip">Via PIP</h3>
<p>The easiest way to install ravestate is through pip:</p>
Expand Down Expand Up @@ -222,7 +209,11 @@ <h2 id="running-tests">Running tests</h2>
<h2 id="buildingmaintaining-the-docs">Building/maintaining the docs</h2>
<p>If you have installed the dependencies from <code>requirements-dev.txt</code>,
generate the docs by running this command at project root:</p>
<p><code>pydocmd build</code></p>
<pre><code class="bash">git rm -rf docs
rm -rf _build docs
pydocmd build
</code></pre>

<p>The structure and content of the docs are defined in the file <code>pydocmd.yml</code>.</p>

</div>
Expand Down Expand Up @@ -272,5 +263,5 @@ <h2 id="buildingmaintaining-the-docs">Building/maintaining the docs</h2>

<!--
MkDocs version : 1.0.4
Build Date UTC : 2019-01-17 00:34:43
Build Date UTC : 2019-01-29 13:58:53
-->
46 changes: 15 additions & 31 deletions docs/modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,23 @@ <h1 id="ravestate.module">ravestate.module</h1>

<h2 id="ravestate.module.Module">Module</h2>

<pre><code class="python">Module(self, *, name: str, props: Tuple[ravestate.property.PropertyBase] = (), states: Tuple[ravestate.state.State] = (), config: Dict[str, Any] = None)
<pre><code class="python">Module(self, *, name: str, config: Dict[str, Any] = None)
</code></pre>

<p>Atomic class, which encapsulates a named set of states, properties and config entries,
which form a coherent bundle.</p>
<h1 id="ravestate.registry">ravestate.registry</h1>

<h2 id="ravestate.registry.import_module">import_module</h2>

<h3 id="ravestate.module.Module.registered_modules">registered_modules</h3>

<p>dict() -&gt; new empty dictionary
dict(mapping) -&gt; new dictionary initialized from a mapping object's
(key, value) pairs
dict(iterable) -&gt; new dictionary initialized as if via:
d = {}
for k, v in iterable:
d[k] = v
dict(**kwargs) -&gt; new dictionary initialized with the name=value pairs
in the keyword argument list. For example: dict(one=1, two=2)
<h2 id="ravestate.module.import_module">import_module</h2></p>
<pre><code class="python">import_module(*, module_name: str, callback)
</code></pre>

Expand All @@ -144,31 +152,7 @@ <h2 id="ravestate.registry.import_module">import_module</h2>
<p><code>callback</code>: A callback which should be called when a module calls register() while it is being imported.</p>
</li>
</ul>
<h2 id="ravestate.registry.register">register</h2>

<pre><code class="python">register(*, name: str = '', props=(), states=(), config=None)
</code></pre>

<p>May be called to register a named set of states, properties and config entries,
which form a coherent bundle.</p>
<ul>
<li>
<p><code>name</code>: The name of the module. Will be prefixed to property and signal names like
<module name>:<property/signal-name>.</p>
</li>
<li>
<p><code>props</code>: The properties that should be registered.</p>
</li>
<li>
<p><code>states</code>: The states that should be registered.</p>
</li>
<li>
<p><code>config</code>: A dictionary of config entries and their default values, which should be read
from the default/user config files.
:return:</p>
</li>
</ul>
<h2 id="ravestate.registry.has_module">has_module</h2>
<h2 id="ravestate.module.has_module">has_module</h2>

<pre><code class="python">has_module(module_name: str)
</code></pre>
Expand All @@ -178,7 +162,7 @@ <h2 id="ravestate.registry.has_module">has_module</h2>
<li><code>module_name</code>: The name which should be checked for beign registered.</li>
</ul>
<p><strong>Returns:</strong> True if a module with the given name has been registered, false otherwise.</p>
<h2 id="ravestate.registry.get_module">get_module</h2>
<h2 id="ravestate.module.get_module">get_module</h2>

<pre><code class="python">get_module(module_name: str)
</code></pre>
Expand Down
Loading

0 comments on commit 4cb44bf

Please sign in to comment.