Methods
defaultOrderDistanceGradient(distance) → {number}
The default falloff gradient used by NILOD
to weight the weakening of distance between
the position of compared tokens.
Parameters:
| Name |
Type |
Description |
distance |
integer
|
The distance of both tokens in their respective sentences' orders. |
- Source:
Returns:
The weakening weight; maxes out at 1 (distance = 0), tends toward 0 as distance increases.
-
Type
-
number
levenshteinSimilarity(s, t) → {number}
Levenshtein _similarity_ between two strings.
Parameters:
| Name |
Type |
Description |
s |
string
|
String 1. |
t |
string
|
String 2. |
- Source:
Returns:
The Levenshtein _similarity_.
-
Type
-
number
NILOD(jGraphopt) → {NilodModel}
NILOD exports. When called, a shorthand for 'new NILOD.
NilodModel(jGraph)'.
Parameters:
| Name |
Type |
Attributes |
Default |
Description |
jGraph |
NilodGraph
|
<optional>
|
null
|
A NILOD model save to be loaded. Omit for an empty model. |
- Source:
Returns:
A new NILOD model.
-
Type
-
NilodModel
tokenize(text) → {string}
Splits text into tokens (heterogeneous clusters of letters/numbers and symbols separated by spaces).
Parameters:
| Name |
Type |
Description |
text |
string
|
The input document, string or text to tokenize. |
- Source:
Returns:
The tokenized result.
-
Type
-
string
Type Definitions
GenerationResults
Properties:
| Name |
Type |
Description |
best |
RatedSample
|
The predicted best sample, out of the samples generated. |
worst |
RatedSample
|
The predicted worst sample, out of the samples generated. _Laughable._ |
bestResult |
string
|
The predicted best sample's result sentence as a string. |
scoreboard |
Array.<RatedSample>
|
A sorted list of samples, in descending order of rating. |
- Source:
NDEdge
Properties:
| Name |
Type |
Description |
from |
string
|
The graph node the edge stems *from*. |
to |
string
|
The graph node the edge ends in*to*. |
fromWord |
string
|
The particular word of the graph node the edge stems from. |
toWord |
string
|
The particular word of the graph node the edge ends onto. |
separator |
string
|
The string that delimits the fromWord and toWord, i.e. the separator between both nodes as per this edge. |
count |
integer
|
The number of occurences of this particular edge that were found during training. Used as a probabilistic measure during sentence generation. |
- Source:
NDNode
Properties:
| Name |
Type |
Description |
words |
Array.<integer>
|
A bag-of-words-encoded list of words that compose this node. |
nextEdges |
Array.<string>
|
A list of IDs of edges that stem from this node. |
prevEdges |
Array.<string>
|
A list of IDs of edges that 'point to' this node. |
- Source:
NilodGraph
Type:
Properties:
| Name |
Type |
Description |
outputHistory |
Array.<string>
|
A history of past generated sentences. |
nodes |
Object.<string, NDNode>
|
The nodes, where the keys are the nodes' IDs. |
edges |
Object.<string, NDEdge>
|
The edges, where the keys are the edges' IDs. |
wordDictionary |
Array.<string>
|
A bag of words, used to losslessly compress the graph. |
- Source:
RatedSample
Properties:
| Name |
Type |
Description |
rating |
number
|
The rating of this sample. |
attempt |
OutputHistory
|
The generated sentence (sample) wrapped by this sample. |
- Source:
SampleOutput
Properties:
| Name |
Type |
Attributes |
Description |
success |
boolean
|
|
Whether this attempt was successful (i.e. no errors). |
seedNode |
string
|
<nullable>
|
The ID of the node that was used as the seed (i.e. the starting point for this sentence). |
seedText |
string
|
<nullable>
|
The string representation of the seed node (see above). |
seedQuery |
string
|
<nullable>
|
The original query from the which the node was deduced (or randomly picked, in case this value is null, which also means there was actually no specific query). |
output |
string
|
<nullable>
|
The output of this query, or null if unsuccessful. |
outputWords |
Array.<string>
|
|
The words that were joined to compose the output property. |
outputID |
string
|
<nullable>
|
The ID of this sentence generation, used when rating it. |
reasonCode |
string
|
<nullable>
|
An upper-case, shorthand string that allows for quick mnemonic identification and comparison of error codes. |
reasonMessage |
string
|
<nullable>
|
A human-readable reason describing the error. |
reasonNumber |
Number
|
|
An integer used to identify this particular reason. |
applyRating |
function
|
|
A method that allows rating this particular generated sentence. Takes a single argument (a rating, usually between -1 and 1). |
- Source: