Skip to content
Permalink
Browse files

Closes #3 about fixing diacritic support in Bravey lib

  • Loading branch information...
thiagodp committed May 28, 2018
1 parent 9221422 commit 42ca4fc027de1e8922e2363de1b22a3ff516c2af
Showing with 17 additions and 16 deletions.
  1. +2 −2 dist/lib/bravey.js
  2. +15 −14 lib/bravey.js
@@ -1120,7 +1120,7 @@ Bravey.RegexEntityRecognizer = function (entityName, additionalPriority) {
* @returns {Entity[]} The set of found entities.
*/
this.getEntities = function (string, out) {
string = Bravey.Text.clean(string); // <<< by TDP
// string = Bravey.Text.clean(string); // <<< by TDP
var found, piece, match, entitiesFound = [], pos = -1;
if (!out)
out = [];
@@ -5244,7 +5244,7 @@ Bravey.Nlp.Fuzzy = function (nlpName, extensions) {
* @returns {false} When the sentence doesn't match any intent.
*/
this.test = function (text, method) {
text = Bravey.Text.clean(text); // <<< by TDP
// text = Bravey.Text.clean(text); // <<< by TDP (commented)
switch (method) {
case "anyEntity":
{
@@ -58,7 +58,7 @@ Bravey.SessionManager = {};
@property {string} string The raw text representing the entity.
@property {number} position The entity position in a sentence.
@property {any} value The entity logic value.
@property {number} priority The entity relative priority.
@property {number} priority The entity relative priority.
*/
// File:src/extras/file.js

@@ -129,7 +129,7 @@ Bravey.Text.generateGUID = function() {
}

/**
* Counts the not empty <tt>positions</tt> of <tt>match</tt>.
* Counts the not empty <tt>positions</tt> of <tt>match</tt>.
* @param {string[]} match - The array to check.
* @param {number[]} positions - The positions to check.
* @returns {number} The count of filled positions.
@@ -1195,7 +1195,8 @@ Bravey.RegexEntityRecognizer = function(entityName, additionalPriority ) { // <<
* @returns {Entity[]} The set of found entities.
*/
this.getEntities = function(string, out) {
string = Bravey.Text.clean(string); // <<< by TDP

// string = Bravey.Text.clean(string); // <<< by TDP

var found, piece, match, entitiesFound = [],
pos = -1;
@@ -1237,7 +1238,7 @@ Bravey.RegexEntityRecognizer = function(entityName, additionalPriority ) { // <<
}

/**
* Called when RegexEntityRecognizer matches a regular expression.
* Called when RegexEntityRecognizer matches a regular expression.
* @callback regexEntityRecognizerCallback
* @param {string[]} match - The matched values.
* @returns {Entity} The processed entity.
@@ -2428,7 +2429,7 @@ Bravey.Language.IT.Numbers = [{
}];

/**
* Recognizes numbers line '123' or 'centoventitre'.
* Recognizes numbers line '123' or 'centoventitre'.
* @constructor
* @param {string} entityName - The name of produced entities.
* @returns {Bravey.RegexEntityRecognizer}
@@ -3354,7 +3355,7 @@ Bravey.Language.EN.Numbers = {
}

/**
* Recognizes numbers line '123' or 'one hundred twenty three'.
* Recognizes numbers line '123' or 'one hundred twenty three'.
* @constructor
* @param {string} entityName - The name of produced entities.
* @returns {Bravey.RegexEntityRecognizer}
@@ -5145,7 +5146,7 @@ Bravey.Language.PT.Numbers = {
};

/**
* Recognizes numbers line '123' or 'cento e vinte três'.
* Recognizes numbers line '123' or 'cento e vinte três'.
* @constructor
* @param {string} entityName - The name of produced entities.
* @returns {Bravey.RegexEntityRecognizer}
@@ -5591,7 +5592,7 @@ Bravey.Nlp.Fuzzy = function(nlpName, extensions) {
* @returns {false} When the sentence doesn't match any intent.
*/
this.test = function(text, method) {
text = Bravey.Text.clean(text); // <<< by TDP
// text = Bravey.Text.clean(text); // <<< by TDP (commented)
switch (method) {
case "anyEntity":
{
@@ -6060,8 +6061,8 @@ Bravey.Nlp.Sequential = function(nlpName, extensions) {
* A basic unofficial compatibility object that can read {@link http://api.ai|Api.ai} exported packages and simulates its output.
* @constructor
* @param {string} packagePath - The path to the exported Api.ai package root.
* @param {string} extensions.language - The language to be used. Possible values are namespace names of {@link Bravey.Language}.
* @param {string} extensions.nlp - The NLP processor to be used. Possible values are namespace names of {@link Bravey.Nlp}.
* @param {string} extensions.language - The language to be used. Possible values are namespace names of {@link Bravey.Language}.
* @param {string} extensions.nlp - The NLP processor to be used. Possible values are namespace names of {@link Bravey.Nlp}.
*/
Bravey.ApiAiAdapter = function(packagePath, extensions) {
extensions = extensions || {};
@@ -6183,7 +6184,7 @@ Bravey.ApiAiAdapter = function(packagePath, extensions) {
}

/**
* Check if a given sentence matches an intent and extracts its entities. Output simulates Api.ai structure. For arguments, check {@link Bravey.Nlp.test}.
* Check if a given sentence matches an intent and extracts its entities. Output simulates Api.ai structure. For arguments, check {@link Bravey.Nlp.test}.
*/
this.test = function(text, method) {
var out = this.nlp.test(text, method);
@@ -6378,7 +6379,7 @@ Bravey.ContextManager = function(extensions) {
* @param {string} text - The sentence to be processed.
* @param {string} [text=<new session id>] - The user session id.
* @returns {ContextManagerResultBySessionId} When an intent is found.
* @returns {false} When the sentence doesn't match any intent.
* @returns {false} When the sentence doesn't match any intent.
*/
this.testBySessionId = function(text, sessionid) {
var ok, found = {
@@ -6399,15 +6400,15 @@ Bravey.ContextManager = function(extensions) {
}

/**
Describes a match from a specific context. See {@link Bravey.ContextManager.testByContext}
Describes a match from a specific context. See {@link Bravey.ContextManager.testByContext}
@typedef ContextManagerResultByContext
@type {Object}
@property {NlpResult} result The result of a query.
@property {string} context The matched context tag. <tt>undefined</tt> if no domain matched.
*/

/**
Describes a match from a specific session ID. See {@link Bravey.ContextManager.testBySessionId}
Describes a match from a specific session ID. See {@link Bravey.ContextManager.testBySessionId}
@typedef ContextManagerResultBySessionId
@type {Object}
@property {NlpResult} result The result of a query.

0 comments on commit 42ca4fc

Please sign in to comment.
You can’t perform that action at this time.