--- active_crumb: Data Model layout: documentation id: data_model ---
Data model is a central concept in NLPCraft defining natural language interface to your data sources like a database or a SaaS application. NLPCraft employs a model-as-a-code approach where entire data model is an implementation of NCModel interface which can be developed using any JVM programming language like Java, Scala, Kotlin, or Groovy.
A data model defines:
Note that model-as-a-code approach natively supports any software life cycle tools and frameworks like various build tools, CI/SCM tools, IDEs, etc. You don't have to use additional web-based tools to manage some aspects of your data models - your entire model and all of its components are part of your project source code.
Here's two quick examples of the fully-functional data model implementations (from Light Switch and Alarm Clock examples). You will find specific details about these implementations in the following sections:
package org.apache.nlpcraft.examples.lightswitch import org.apache.nlpcraft.model.{NCIntentTerm, _} class LightSwitchModel extends NCModelFileAdapter("lightswitch_model.yaml") { @NCIntentRef("ls") @NCIntentSample(Array( "Turn the lights off in the entire house.", "Switch on the illumination in the master bedroom closet.", "Get the lights on.", "Lights up in the kitchen.", "Please, put the light out in the upstairs bedroom.", "Set the lights on in the entire house.", "Turn the lights off in the guest bedroom.", "Could you please switch off all the lights?", "Dial off illumination on the 2nd floor.", "Please, no lights!", "Kill off all the lights now!", "No lights in the bedroom, please.", "Light up the garage, please!" )) def onMatch( @NCIntentTerm("act") actTok: NCToken, @NCIntentTerm("loc") locToks: List[NCToken] ): NCResult = { val status = if (actTok.getId == "ls:on") "on" else "off" val locations = if (locToks.isEmpty) "entire house" else locToks.map(_.meta[String]("nlpcraft:nlp:origtext")).mkString(", ") // Add HomeKit, Arduino or other integration here. // By default - return a descriptive action string. NCResult.text(s"Lights are [$status] in [${locations.toLowerCase}].") } }
id: "nlpcraft.lightswitch.ex" name: "Light Switch Example Model" version: "1.0" description: "NLI-powered light switch example model." macros: - name: "<ACTION>" macro: "{turn|switch|dial|let|set|get|put}" - name: "<KILL>" macro: "{shut|kill|stop|eliminate}" - name: "<ENTIRE_OPT>" macro: "{entire|full|whole|total|_}" - name: "<FLOOR_OPT>" macro: "{upstairs|downstairs|{1st|first|2nd|second|3rd|third|4th|fourth|5th|fifth|top|ground} floor|_}" - name: "<TYPE>" macro: "{room|closet|attic|loft|{store|storage} {room|_}}" - name: "<LIGHT>" macro: "{all|_} {it|them|light|illumination|lamp|lamplight}" enabledBuiltInTokens: [] # This example doesn't use any built-in tokens. # # Allows for multi-word synonyms in this entire model # to be sparse and permutate them for better detection. # These two properties generally enable a free-form # natural language comprehension. # permutateSynonyms: true sparse: true elements: - id: "ls:loc" description: "Location of lights." synonyms: - "<ENTIRE_OPT> <FLOOR_OPT> {kitchen|library|closet|garage|office|playroom|{dinning|laundry|play} <TYPE>}" - "<ENTIRE_OPT> <FLOOR_OPT> {master|kid|children|child|guest|_} {bedroom|bathroom|washroom|storage} {<TYPE>|_}" - "<ENTIRE_OPT> {house|home|building|{1st|first} floor|{2nd|second} floor}" - id: "ls:on" groups: - "act" description: "Light switch ON action." synonyms: - "<ACTION> {on|up|_} <LIGHT> {on|up|_}" - "<LIGHT> {on|up}" - id: "ls:off" groups: - "act" description: "Light switch OFF action." synonyms: - "<ACTION> <LIGHT> {off|out|down}" - "{<ACTION>|<KILL>} {off|out|down} <LIGHT>" - "<KILL> <LIGHT>" - "<LIGHT> <KILL>" - "{out|no|off|down} <LIGHT>" - "<LIGHT> {out|off|down}" intents: - "intent=ls term(act)={has(tok_groups, 'act')} term(loc)={# == 'ls:loc'}*"
package org.apache.nlpcraft.examples.alarm; import org.apache.nlpcraft.model.*; import java.time.*; import java.util.*; import static java.time.temporal.ChronoUnit.MILLIS; public class AlarmModel extends NCModelFileAdapter { private static final DateTimeFormatter FMT = DateTimeFormatter.ofPattern("HH'h' mm'm' ss's'").withZone(ZoneId.systemDefault()); private final Timer timer = new Timer(); public AlarmModel() { // Loading the model from the file. super("alarm_model.json"); } @NCIntentRef("alarm") // Intent is defined in JSON model file (alarm_model.json and intents.idl). @NCIntentSampleRef("alarm_samples.txt") // Samples supplied in an external file. NCResult onMatch( NCIntentMatch ctx, @NCIntentTerm("nums") List<NCToken> numToks ) { long ms = calculateTime(numToks); assert ms >= 0; timer.schedule( new TimerTask() { @Override public void run() { System.out.println( "BEEP BEEP BEEP for: " + ctx.getContext().getRequest().getNormalizedText() + "" ); } }, ms ); return NCResult.text("Timer set for: " + FMT.format(LocalDateTime.now().plus(ms, MILLIS))); } @Override public void onDiscard() { // Clean up when model gets discarded (e.g. during testing). timer.cancel(); } public static long calculateTime(List<NCToken> numToks) { LocalDateTime now = LocalDateTime.now(); LocalDateTime dt = now; for (NCToken num : numToks) { String unit = num.meta("nlpcraft:num:unit"); // Skip possible fractional to simplify. long v = ((Double)num.meta("nlpcraft:num:from")).longValue(); if (v <= 0) throw new NCRejection("Value must be positive: " + unit); switch (unit) { case "second": { dt = dt.plusSeconds(v); break; } case "minute": { dt = dt.plusMinutes(v); break; } case "hour": { dt = dt.plusHours(v); break; } case "day": { dt = dt.plusDays(v); break; } case "week": { dt = dt.plusWeeks(v); break; } case "month": { dt = dt.plusMonths(v); break; } case "year": { dt = dt.plusYears(v); break; } default: // It shouldn't be an assertion, because 'datetime' unit can be extended outside. throw new NCRejection("Unsupported time unit: " + unit); } } return now.until(dt, MILLIS); } }
// Fragments (mostly for demo purposes here). fragment=buzz term~{# == 'x:alarm'} fragment=when term(nums)~{ // Demonstrating term variables. @type = meta_tok('nlpcraft:num:unittype') @iseq = meta_tok('nlpcraft:num:isequalcondition') // Excludes conditional statements. # == 'nlpcraft:num' && @type == 'datetime' && @iseq == true }[1,7] // Intents (using fragments). intent=alarm fragment(buzz) fragment(when)
{ "id": "nlpcraft.alarm.ex", "name": "Alarm Example Model", "version": "1.0", "description": "Alarm example model.", "enabledBuiltInTokens": [ "nlpcraft:num" ], "elements": [ { "id": "x:alarm", "description": "Alarm token indicator.", "synonyms": [ "{ping|buzz|wake|call|hit} {me|up|me up|_}", "{set|_} {my|_} {wake|wake up|_} {alarm|timer|clock|buzzer|call} {clock|_} {up|_}" ] } ], "intents": [ "import('intents.idl')" // Import intents from external file. ] }
Further sub-sections will provide details on model's static configuration and dynamic programmable logic implementation.
Let's review the general dataflow of the user request in NLPCraft (from right to left). User request starts with the user application (like a chatbot or NLI-based system) making a REST call using NLPCraft REST API. That REST call carries among other things the input text and data model ID, and it arrives first to the REST server.
Upon receiving the user request, the REST server performs NLP pre-processing converting the input text into a sequence of tokens and enriching them with additional information. Once finished, the sequence of tokens is sent further down to the probe where the requested data model is deployed.
Upon receiving that sequence of tokens, the data probe further enriches it based on the user data model and matches it against declared intents. When a matching intent is found its callback method is called and its result travels back from the data probe to the REST server and eventually to the user that made the REST call.
Security & Isolation
Note that in this architecture the user-defined data model is fully isolated from the REST server accepting user calls. Users never access data probes and hence data models directly. Typically REST server should be deployed in DMZ and only ingress connectivity is required from the REST server to data probes.
Data model is an implementation of NCModel interface. NCModel interface has defaults for most of its methods. These are the only methods that must to be implemented by its sub-class:
You can either implement NCModel interface directly or use one of the adapters (recommended in most cases):
Note that you can also use 3rd party IoC frameworks like Spring to construct your data models. See NCModelFactory for more information.
Using Adapters
It is recommended to use one of the adapter classes when defining your own data model in the most uses cases.
Data models get deployed to and hosted by the data probes - a lightweight container whose job is to host data models and securely transfer requests between REST server and the data models. When a data probe starts it reads its configuration to see which models to deploy.
Note that data probes don't support hot-redeployment. To redeploy the data model you need to restart the data probe. Note also that data probe can be started in embedded mode, i.e. it can be started from within an existing JVM process like user application.
There are two lifecycle callbacks on NCModel interface (by way of extending NCLifecycle interface) that you can override to affect the the default lifecycle behavior:
There are also several callbacks that you can override to affect model behavior during intent matching to perform logging, debugging, statistic or usage collection, explicit update or initialization of conversation context, security audit or validation:
Callbacks onContext(...) and onMatchedIntent(...) are especially handy to perform a soft reset on the conversation context. Read their Javadoc documentation to understand these callbacks protocol.
Note that both the server and the probe provide their own lifecycle components support. When registered in the probe or server configuration the lifecycle components will be called during various stages of the probe or server startup or shutdown procedures. These callbacks can be used to control lifecycle of external libraries and systems that the data probe or the server rely on, i.e. OpenCensus exporters, security environment, devops hooks, etc.
See server and probe configuration.
Apart from mandatory model ID, name and version there is a number of static model configurations that you can set. All of these properties have sensible defaults that you can override, when required, in either sub-classes or via external JSON/YAML declaration:
You can move out all the static model configuration into an external JSON or YAML file. To load that configuration you need to use NCModelFileAdapter adapter when creating your data model. Here are JSON and YAML sample templates and you can find more details in NCModel Javadoc and in examples.
{ "id": "user.defined.id", "name": "User Defined Name", "version": "1.0", "description": "Short model description.", "enabledBuiltInTokens": ["google:person", "google:location"] "macros": [], "metadata": {}, "elements": [ { "id": "x:id", "description": "", "groups": [], "parentId": "", "synonyms": [], "metadata": {}, "values": [] } ], ... "intents": [] }
id: "user.defined.id" name: "User Defined Name" version: "1.0" description: "Short model description." macros: enabledBuiltInTokens: elements: - id: "x:id" description: "" synonyms: groups: values: parentId: metadata: ... intents:
Named entity, also known as a model element or a token, is one of the main a components defined by the NLPCraft data model. A named entity is one or more individual words that have a consistent semantic meaning and typically denote a real-world object, such as persons, locations, number, date and time, organizations, products, etc. Such object can be abstract or have a physical existence.
For example, in the following sentence:
the following named entities can be detected:
| Words | Type | Normalized Value |
|---|---|---|
| Top 20 | nlpcraft:limit |
top 20 |
| best pages | user:element |
best pages |
| California USA | nlpcraft:geo |
USA, California |
| last 3 months | nlpcraft:date |
1/1/2021 - 4/1/2021 |
In most cases named entities will have associated normalized value. It is especially important for named entities that have many
notational forms such as time and date, currency, geographical locations, etc. For example, New York
,
New York City
and NYC
all refer to the same "New York City, NY USA" location which is a standard normalized form.
The process of detecting named entities is called Named Entity Recognition (NER). There are many ways of how a certain named entity can be detected: through list of synonyms, by name, rule-based or by using statistical techniques like neural networks with large corpus of predefined data. NLPCraft natively supports synonym-based named entities definition as well as the ability to compose new named entities through powerful Intent Definition Language (IDL) combining other named entities including named entities from external project such OpenNLP, spaCy or Stanford CoreNLP.
Named entities allow you to abstract from basic linguistic forms like nouns and verbs to deal with the higher level semantic abstractions like geographical location or time when you are trying to understand the meaning of the sentence. One of the main goals of named entities is to act as an input ingredients for intent matching.
😀 User Input → Named Entities → Parsing Variants → Intent Matcher → Winning Intent 🚀
User input is parsed into the list of named entities. That list is then further transformed into one or more parsing variants where each variant represents a particular order and combination of detected named entities. Finally, the list of variants act as an input to intent matching where each variant is matched against every intent in the process of detecting the best matching intent for the original user input.
Data model element defines a named entity that will be detected in the user input. Model element is an implementation of NCElement interface. NCModel provides its elements via getElements() method. Typically, you create model elements by either:
Note that when you use external static model configuration with JSON or YAML you can still modify it after it was loaded using NCModelFileAdapter adapter. It is particular convenient when synonyms or values are loaded separately from, or in addition to, the model elements themselves, i.e. from a database or another file.
Model Element & Named Entity & Token
Terms 'model element', 'named entity' and 'token' are used throughout this documentation relatively interchangeably:
Although model element and named entity describe a similar concept, the NLPCraft model elements provide a much more powerful instrument. Unlike named entities support in other projects NLPCraft model elements have number of unique capabilities:
Additionally to the model elements that are defined by the user in the data model (i.e. user model elements) NLPCraft provides its own built-in named entities as well as the integration with number of 3rd party projects. You can think of these built-in elements as if they were implicitly defined in your model - you can use them in exactly the same way as if you defined them yourself. You can find more information on how to configure external token providers in Integrations section.
Note that you can't directly change group membership, parent-child relationship or metadata of the
built-in elements. You can, however, "wrap" built-in entity into your own one using ^^{tok_id() == 'external.id'}^^
IDL expression as its synonym where you can define all necessary additional
configuration properties (more on that below).
NLPCraft uses fully deterministic named entity recognition and is not based on statistical approaches that would require pre-existing marked up data sets and extensive training. For each model element you can either provide a set of synonyms to match on or specify a piece of code that would be responsible for detecting that named entity (discussed below). A synonym can have one or more individual words. Note that element's ID is its implicit synonym so that even if no additional synonyms are defined at least one synonym always exists. Note also that synonym matching is performed on normalized and stemmatized forms of both a synonym and user input.
Here's an example of a simple model element definition in JSON:
... "elements": [ { "id": "transport.vehicle", "description": "Transportation vehicle", "synonyms": [ "car", "truck", "light duty truck" "heavy duty truck" "sedan", "coupe" ] } ] ...
While adding multi-word synonyms looks somewhat trivial - in real models, the naive approach can lead to thousands and even tens of thousands of possible synonyms due to words, grammar, and linguistic permutations - which quickly becomes untenable if performed manually.
NLPCraft provides an effective tool for a compact synonyms representation. Instead of listing all possible multi-word synonyms one by one you can use combination of following techniques:
Each whitespace separated string in the synonym can be either a regular word (like in the above transportation example where it will be matched on using its normalized and stemmatized form) or one of the above expression.
Note that this synonyms definition is also used in the following NCElement methods:
getSynonyms()
- gets synonyms to match on.getValues()
- get values to match on (see below).Model element can have an optional set of special synonyms called values or "proper nouns" for this element. Unlike basic synonyms, each value is a pair of a name and a set of standard synonyms by which that value, and ultimately its element, can be recognized in the user input. Note that the value name itself acts as an implicit synonym even when no additional synonyms added for that value.
When a model element is recognized it is made available to the model's matching logic as an instance of the NCToken interface. This interface has a method getValue() which returns the name of the value, if any, by which that model element was recognized. That value name can be further used in intent matching.
To understand the importance of the values consider the following changes to our transportation example model:
... "macros": [ { "name": "<TRUCK_TYPE>", "macro": "{light duty|heavy duty|half ton|1/2 ton|3/4 ton|one ton|super duty}" } ] "elements": [ { "id": "transport.vehicle", "description": "Transportation vehicle", "synonyms": [ "car", "{<TRUCK_TYPE>|_} {pickup|_} truck" "sedan", "coupe" ], "values": [ { "value": "mercedes", "synonyms": ["mercedes-ben{z|s}", "mb", "ben{z|s}"] }, { "value": "bmw", "synonyms": ["{bimmer|bimer|beemer}", "bayerische motoren werke"] } { "value": "chevrolet", "synonyms": ["chevy"] } ] } ] ...
With that setup transport.vehicle
element will be recognized by any of the following input string:
car
benz
(with value mercedes
)3/4 ton pickup truck
light duty truck
chevy
(with value chevrolet
)bimmer
(with value bmw
)transport.vehicle
Each model element always belongs to one or more groups. Model element provides its groups via getGroups() method. By default, if element group is not specified, the element ID will act as its default group ID. Group membership is a quick and easy way to organise similar model elements together and use this categorization in IDL intents.
Note that the proper grouping of the elements is also necessary for the correct operation of Short-Term-Memory (STM) in the conversational context. Consider a NCToken that represents a previously found model element that is stored in the conversation. Such token will be overridden in the conversation by the more recent token from the same group - a critical rule of maintaining the proper conversational context. See NCConversation for mode details.
Element ParentEach model element can form an optional hierarchical relationship with other element by specifying its parent element ID via getParentID() method. The main idea here is that sometimes model elements can act not only individually but their place in the hierarchy can be important too.
For example, we could have designed our transportation example model in a different way by using multiple model elements linked with this hierarchy:
+-- vehicle | +--truck | | |-- light.duty.truck | | |-- heavy.duty.truck | | +-- medium.duty.truck | +--car | | |-- coupe | | |-- sedan | | |-- hatchback | | +-- wagon
Then in our intent, for example, we could look for any token with root parent ID vehicle
or immediate parent ID truck
or car
without a need to match on all current and
future individual sub-IDs. For example:
intent=vehicle.intent term~{has(tok_ancestors, 'vehicle')} intent=truck.intent term~{tok_parent == 'truck'} intent=car.intent term~{tok_parent == 'car'}
Listing all possible multi-word synonyms for a given element can be a time-consuming task. Macros
together with option groups allow for significant simplification of this task.
Macros allow you to give a name to an often used set of words or option groups and reuse it without
repeating those words or option groups again and again. A model provides a list of macros via
getMacros() method.
Each macro has a name in a form of <X>
where X
is any string, and a string value. Note that macros can be nested (but not recursive), i.e. macro value can include
references to other macros. When macro name X
is encountered in the synonym it gets recursively
replaced with its value.
Here's a code snippet of macro definitions using JSON definition:
"macros": [ { "name": "<A>", "macro": "aaa" }, { "name": "<B>", "macro": "<A> bbb" }, { "name": "<C>", "macro": "<A> bbb {z|w}" } ]Option Groups
Option groups are similar to wildcard patterns that operates on a single word base. One line of option group expands into one or more individual synonyms. Option groups is the key mechanism for shortened synonyms notation. The following examples demonstrate how to use option groups.
Consider the following macros defined below (note that macros <B>
and <C>
are nested):
| Name | Value |
|---|---|
<A> |
aaa |
<B> |
<A> bbb |
<C> |
<A> bbb {z|w} |
Then the following option group expansions will occur in these examples:
| Synonym | Synonym Expansions |
|---|---|
<A> {b|_} c |
"aaa b c" "aaa c"
|
<A> {b|a}[1,2] c |
"aaa b c" "aaa b b c" "aaa a c" "aaa a a c" "aaa c"
|
<B> {b|_} c or <B> {b}[0,1] c
|
"aaa bbb b c" "aaa bbb c"
|
{b|\{\_\}} |
"b" "b {_}"
|
a {b|_}. c |
"a b. c" "a . c"
|
a .{b, |_}. c |
"a .b, . c" "a .. c"
|
{% raw %}a {{b|c}|_}.{% endraw %} |
"a ." "a b." "a c."
|
a {% raw %}{{{<C>}}|{_}}{% endraw %} c |
"a aaa bbb z c" "a aaa bbb w c" "a c"
|
{% raw %}{{{a}}} {b||_|{{_}}||_}{% endraw %} |
"a b" "a"
|
Specifically:
{A|B}
denotes either A
or B
.{A|B|_}
denotes either A
or B
or nothing.
_
cam appear anywhere in the list of options, i.e. {A|B|_}
is equal to {A|_|B}
.{C}[x,y]
denotes an option group with quantifier, i.e. group C
appearing from x
to y
times inclusive.
{C}[1,3]
is the same as {C|C C|C C C}
notation.{C|_}
is equal to {C}[0,1]
'\'
(backslash) can be used to escape '{'
, '}'
, '|'
and
'_'
special symbols used by the option groups.
We can rewrite our transportation model element in a more efficient way using macros and option groups. Even though the actual length of definition hasn't changed much it now auto-generates many dozens of synonyms we would have to write out manually otherwise:
... "macros": [ { "name": "<TRUCK_TYPE>", "macro": "{ {light|super|heavy|medium} duty|half ton|1/2 ton|3/4 ton|one ton}" } ] "elements": [ { "id": "transport.vehicle", "description": "Transportation vehicle", "synonyms": [ "car", "{<TRUCK_TYPE>|_} {pickup|_} truck" "sedan", "coupe" ] } ] ...Regular Expressions
Any individual synonym word that starts and ends with //
(two forward slashes) is
considered to be Java regular expression as defined in java.util.regex.Pattern
. Note that
regular expression can only span a single word, i.e. only individual words from the user input will be
matched against given regular expression and no whitespaces are allowed within regular expression. Note
also that option group special symbols {
, }
,
|
and _
have to be escaped in the regular expression using \
(backslash).
For example, the following synonym:
"synonyms": [ "{foo|//[bar].+//}}" ]
will match word foo
or any other strings that start with bar
as long as
this string doesn't contain whitespaces.
It's important to note that regular expressions can significantly affect the performance of the NLPCraft processing if used uncontrolled. Use it with caution and test the performance of your model to ensure it meets your requirements.
Any individual synonym word that that starts and ends with ^^
is a
IDL expression. IDL
expression inside of ^^ ... ^^
markers allows you to define a predicate on already parsed and detected token.
It is very important to note that unlike all other synonyms the IDL expression operates on a
already detected token, not on an individual unparsed word.
IDL expressions allows you to compose named entities, i.e. use one name entity when defining another one. For example, we could define a model element for the race car using our previous transportation example (note how synonym on line 18 references the element defined on line 4):
... "elements": [ { "id": "transport.vehicle", "description": "Transportation vehicle", "synonyms": [ "car", "truck", "{light|heavy|super|medium} duty {pickup|_} truck" "sedan", "coupe" ] }, { "id": "race.vehicle", "description": "Race vehicle", "synonyms": [ "{race|speed|track} ^^{# == 'transport.vehicle'}^^" ] } ] ...
Greedy NERs & Synonyms Conflicts
Note that in the above example you need to ensure that words race
,
speed
or track
are not part of the transport.vehicle
token. It is particular important for the 3rd party NERs where specific rules about what
words can or cannot be part of the token are unclear or undefined. In such cases the only remedy is
to extensively test with 3rd party NERs and verify the synonyms recognition in data probe logs.
Another use case is to wrap 3rd party named entities to add group membership, metadata or hierarchical
relationship to the externally defined named entity. For example, you can wrap google:location
token and add group membership for my_group
group:
... "elements": [ { "id": "google.loc.wrap", "description": "Wrapper for google location", "groups": ["my_group"], "synonyms": [ "^^{# == 'google:location'}^^" ] } ] ...IDL Expression Syntax
IDL expressions are a subset of overall IDL syntax. You can review formal ANTLR4 grammar but basically an IDL expression for synonym is a term expression with the optional alias at the beginning. Here's an example of IDL expression defining a synonym for the population of any city in France:
"synonyms": [ "population {of|for} ^^[city]{# == 'nlpcraft:city' && lowercase(meta_tok('city:country')) == 'france'}^^" ]NOTES:
city
can be used to access a constituent part token (with ID nlpcraft:city
).{
and }
brackets is a standard IDL term expression.
By default, the data model detects its elements by their synonyms, regexp or IDL expressions. However, in some cases these methods are either not expressive enough or cannot be used. For example, detecting model elements based on neural networks or integration with a non-standard 3rd-party NER components. In such cases, a user-defined parser can be defined for the model that would allow the user to define its own arbitrary NER logic to detect the model elements in the user input programmatically. Note that a custom parser can detect any number of model elements.
Model provides its custom parsers via getParsers() method.
When a user sends its request via REST API it is received by the REST server. Upon receipt, the REST server does the basic NLP processing and enriching. Once finished, the REST server sends the enriched request down to a specific data probe selected based on the requested data model.
The model logic is defined in intents, specifically in the intent callbacks that get called when their intent is chosen as a winning match against the user request. Below we will quickly discuss the key APIs that are essential for developing intent callbacks. Note that this does now replace a more detailed Javadoc documentation that you are encouraged to read through as well:
This interface provides read-only view on data model. Model view defines a declarative, or configurable, part of the model. All properties in this interface can be defined or overridden in JSON/YAML external presentation when used with NCModelFileAdapter adapter.
This interface defines a context of a particular intent match. It can be passed into the callback of the matched intent and provides the following:
This interface provides all available data about the parsed user input and all its
supplemental information. It's accessible from NCIntentMatch
interface and
provide large amount of information to the intent callback logic:
NCRequest interface is one of the several important entities in Data Model API that you as a model developer will be working with. You should review its Javadoc but here is an outline of the information it provides:
NCToken object is another key abstraction in Data Model API. A token is a detected model element and is a part of a fully parsed user input. Sequence of tokens represents parsed user input. A single token corresponds to a one or more words, sequential or not, in the user sentence.
Most of the token's information is stored in map-based metadata accessible via getMetadata() method. Depending on the token ID each token will have different set of metadata properties. Some common NLP properties are always present for tokens of all types.
This class defines the result returned from model's intent callbacks. Result consists of the text body and the type. The result types are similar in notion to MIME type and have specific meaning only for REST applications that interpret them accordingly. For example, the REST client interfacing between NLPCraft and Amazon Alexa or Apple HomeKit could only accept text result type and ignore everything else.
Interface NCMetadata provides support for mutable runtime-only metadata. This interface can be used to attach user-defined runtime data to variety of different objects in NLPCraft API. This interface is implemented by the following types:
NLPCraft provides a number of built-in model elements (i.e. tokens) including the integration with several popular 3rd party NER frameworks. Table below provides information about these built-in tokens. Section about token metadata provides further information about metadata that each type of token carries.
Built-in tokens have to be explicitly enabled on both the REST server and in the model. See
nlpcraft.server.tokenProviders
configuration property and
NCModelView#getEnabledBuiltInTokens()
method for more details. By default, only NLPCraft tokens are enabled (token ID
starting with nlpcraft
).
| Token ID | Description | Example |
|---|---|---|
nlpcraft:nlp |
This token denotes a word (always a single word) that is not a part of any other token. It's also call a free-word, i.e. a word that is not linked to any other detected model element. NOTE: the metadata from this token defines a common set of NLP properties and is present in every other token as well. |
|
nlpcraft:date |
This token denotes a date range. It recognizes dates from 1900 up to 2023. Note that it does not currently recognize time component. |
|
nlpcraft:num |
This token denotes a single numeric value or numeric condition. |
|
nlpcraft:continent |
This token denotes a geographical continent. |
|
nlpcraft:subcontinent |
This token denotes a geographical subcontinent. |
|
nlpcraft:region |
This token denotes a geographical region/state. |
|
nlpcraft:country |
This token denotes a country. |
|
nlpcraft:city |
This token denotes a city. |
|
nlpcraft:metro |
This token denotes a metro area. |
|
nlpcraft:sort |
This token denotes a sorting or ordering. |
|
nlpcraft:limit |
This token denotes a numerical limit. |
|
nlpcraft:coordinate |
This token denotes a latitude and longitude coordinates. |
|
nlpcraft:relation |
This token denotes a relation function:
compare or
correlate . Note this token always need another two tokens that it references.
|
|
google:xxx |
These tokens denote See integration section for more details on how to configure Google named entity provider. |
|
opennlp:xxx |
These tokens denote See integration section for more details on how to configure Apache OpenNLP named entity provider. |
|
spacy:xxx |
These tokens denote See integration section for more details on how to configure spaCy named entity provider. |
|
stanford:xxx |
These tokens denote See integration section for more details on how to configure Stanford CoreNLP named entity provider. |
|
Each token has different set of metadata. Sections below describe metadata for each built-in token supported by NLPCraft:
nlpcraft:nlp
nlpcraft:date
nlpcraft:num
nlpcraft:city
nlpcraft:continent
nlpcraft:subcontinent
nlpcraft:region
nlpcraft:country
nlpcraft:metro
nlpcraft:coordinate
nlpcraft:sort
nlpcraft:limit
nlpcraft:relation
stanford:xxx
spacy:xxx
google:xxx
opennlp:xxx
Metadata Name Conflicts
Note that model element metadata gets merged into the same map container as common NLP token metadata
(see nlpcraft:nlp:xxx
properties below).
In other words, their share the same namespace. It is important to remember that and choose unique names
for user-defined metadata properties. One possible way that is used by NLPCraft internally is to prefix
metadata name with some unique prefix based on the token ID.
nlpcraft:nlp
This token's metadata provides common basic NLP properties that are part of any token. All tokens without exception have these metadata properties. This metadata represents a common set of NLP properties for a given token. All these metadata properties are mandatory. Note also that interface NCToken provides a direct access to most of these properties.
| Property | Java Type | Description |
|---|---|---|
nlpcraft:nlp:unid |
java.lang.String |
Internal globally unique system ID of the token. |
nlpcraft:nlp:bracketed |
java.lang.Boolean |
Whether or not this token is surrounded by any of '[' , ']' , '{' , '}' , '(' , ')' brackets. |
nlpcraft:nlp:freeword |
java.lang.Boolean |
Whether or not this token represents a free word. A free word is a token that was detected neither as a part of user defined or system tokens. |
nlpcraft:nlp:direct |
java.lang.Boolean |
Whether or not this token was matched on direct (not permutated) synonym. |
nlpcraft:nlp:english |
java.lang.Boolean |
Whether this token represents an English word. Note that this only checks that token's text consists of characters of English alphabet, i.e. the text doesn't have to be necessary a known valid English word. See NCModelView.isNonEnglishAllowed() method for corresponding model configuration. |
nlpcraft:nlp:lemma |
java.lang.String |
Lemma of this token, i.e. a canonical form of this word. Note that stemming and lemmatization allow to reduce inflectional forms and sometimes derivationally related forms of a word to a common base form. Lemmatization refers to the use of a vocabulary and morphological analysis of words, normally aiming to remove inflectional endings only and to return the base or dictionary form of a word, which is known as the lemma. Learn more at https://nlp.stanford.edu/IR-book/html/htmledition/stemming-and-lemmatization-1.html |
nlpcraft:nlp:stem |
java.lang.String |
Stem of this token. Note that stemming and lemmatization allow to reduce inflectional forms and sometimes derivationally related forms of a word to a common base form. Unlike lemma, stemming is a basic heuristic process that chops off the ends of words in the hope of achieving this goal correctly most of the time, and often includes the removal of derivational affixes. Learn more at https://nlp.stanford.edu/IR-book/html/htmledition/stemming-and-lemmatization-1.html |
nlpcraft:nlp:pos |
java.lang.String |
Penn Treebank POS tag for this token. Note that additionally to standard Penn Treebank POS tags NLPCraft introduced '---' synthetic tag to indicate a POS tag for multiword tokens. Learn more at http://www.ling.upenn.edu/courses/Fall_2003/ling001/penn_treebank_pos.html |
nlpcraft:nlp:posdesc |
java.lang.String |
Description of Penn Treebank POS tag. Learn more at http://www.ling.upenn.edu/courses/Fall_2003/ling001/penn_treebank_pos.html |
nlpcraft:nlp:swear |
java.lang.Boolean |
Whether or not this token is a swear word. NLPCraft has built-in list of common English swear words. See NCModelView.isSwearWordsAllowed() for corresponding model configuration |
nlpcraft:nlp:origtext |
java.lang.String |
Original user input text for this token. |
nlpcraft:nlp:normtext |
java.lang.String |
Normalized user input text for this token. |
nlpcraft:nlp:sparsity |
java.lang.Integer |
Numeric value of how sparse the token is. Sparsity zero means that all individual words in the token follow each other. |
nlpcraft:nlp:minindex |
java.lang.Integer |
Index of the first word in this token. Note that token may not be contiguous. |
nlpcraft:nlp:maxindex |
java.lang.Integer |
Index of the last word in this token. Note that token may not be contiguous. |
nlpcraft:nlp:wordindexes |
java.util.List<Integer> |
List of original word indexes in this token. Note that a token can have words that are not contiguous in the original sentence. Always has at least one element in it. |
nlpcraft:nlp:wordlength |
java.lang.Integer |
Number of individual words in this token. Equal to the size of wordindexes list.
|
nlpcraft:nlp:contiguous |
java.lang.Boolean |
Whether or not this token has zero sparsity, i.e. consists of contiguous words. |
nlpcraft:nlp:start |
java.lang.Integer |
Start character index of this token. |
nlpcraft:nlp:end |
java.lang.Integer |
End character index of this token. |
nlpcraft:nlp:index |
java.lang.Integer |
Index of this token in the sentence. |
nlpcraft:nlp:charlength |
java.lang.Integer |
Character length of this token. |
nlpcraft:nlp:quoted |
java.lang.Boolean |
Whether or not this token is surrounded by single or double quotes. |
nlpcraft:nlp:stopword |
java.lang.Boolean |
Whether or not this token is a stopword. Stopwords are some extremely common words which add little value in helping understanding user input and are excluded from the processing entirely. For example, words like a, the, can, of, about, over, etc. are typical stopwords in English. NLPCraft has built-in set of stopwords. |
nlpcraft:nlp:dict |
java.lang.Boolean |
Whether or not this token is found in Princeton WordNet database. |
nlpcraft:date
This token denotes a date range including single days.
Additionally to nlpcraft:nlp:xxx
properties this type of token will have the following
metadata properties all of which are mandatory.
| Property | Java Type | Description |
|---|---|---|
nlpcraft:date:from |
java.lang.Long |
Start timestamp of the datetime range. |
nlpcraft:date:to |
java.lang.Long |
End timestamp of the datetime range. |
nlpcraft:num
This token denotes a single numerical value or a numeric condition.
Additionally to nlpcraft:nlp:xxx
properties this type of token will have the following
metadata properties all of which are mandatory unless otherwise noted.
| Property | Java Type | Description |
|---|---|---|
nlpcraft:num:from |
java.lang.Double |
Start of numeric range that satisfies the condition (exclusive). Note that if from
and to are the same this token represent a single value (whole or fractional) in
which case isequalcondition > will be true .
|
nlpcraft:num:to |
java.lang.Double |
Ed of numeric range that satisfies the condition (exclusive). Note that if from
and to are the same this token represent a single value (whole or fractional) in
which case isequalcondition > will be true .
|
nlpcraft:num:fromincl |
java.lang.Boolean |
Whether or not start of the numeric range is inclusive |
nlpcraft:num:toincl |
java.lang.Boolean |
Whether or not end of the numeric range is inclusive |
nlpcraft:num:isequalcondition |
java.lang.Boolean |
Whether this is an equality condition. Note that single numeric values also default to equality
condition and this property will be true . Indeed, A is equal to 2 and
A is 2 have the same meaning.
|
nlpcraft:num:isnotequalcondition |
java.lang.Boolean |
Whether this is a not-equality condition. |
nlpcraft:num:isfromnegativeinfinity |
java.lang.Boolean |
Whether this range is from negative infinity. |
nlpcraft:num:israngecondition |
java.lang.Boolean |
Whether this is a range condition. |
nlpcraft:num:istopositiveinfinity |
java.lang.Boolean |
Whether this range is to positive infinity. |
nlpcraft:num:isfractional |
java.lang.Boolean |
Whether this token's value (single numeric value of a range) is a whole or a fractional number. |
nlpcraft:num:unit opt. |
java.lang.String |
Optional numeric value unit name (see below). |
nlpcraft:num:unittype opt. |
java.lang.String |
Optional numeric value unit type (see below). |
Following table provides possible values for nlpcraft:num:unit
and nlpcraft:num:unittype
properties:
| num:unittype | num:unit possible values |
|---|---|
mass | feet per second grams kilogram grain dram ounce pound hundredweight ton tonne slug |
torque | newton meter |
area | square meter acre are hectare square inches square feet square yards square miles |
paper quantity | paper bale |
force | kilopond pond |
pressure | pounds per square inch |
solid angle | steradian |
pressure stress | pascal |
luminous | flux lumen |
amount of substance | mole |
luminance | candela per square metre |
angle | radian degree |
magnetic flux density magnetic field | tesla |
power radiant flux | watt |
datetime | second minute hour day week month year |
electrical inductance | henry |
electric charge | coulomb |
temperature | kelvin centigrade fahrenheit |
voltage electrical | volt |
momentum | kilogram meters per second |
amount of heat | calorie |
electrical capacitance | farad |
radioactive decay | becquerel |
electrical conductance | siemens |
luminous intensity | candela |
work energy | joule |
quantities | dozen |
density | density |
sound | decibel |
electrical resistance impedance | ohm |
force weight | newton |
light quantity | lumen seconds |
length | meter millimeter centimeter decimeter kilometer astronomical unit light year parsec inch foot yard mile nautical mile |
refractive index | diopter |
frequency | hertz angular frequency |
power | kilowatt horsepower bar |
magnetic flux | weber |
current | ampere |
acceleration of gravity | gravity imperial gravity metric |
volume | cubic meter liter milliliter centiliter deciliter hectoliter cubic inch cubic foot cubic yard acre-foot teaspoon tablespoon fluid ounce cup gill pint quart gallon |
speed | miles per hour meters per second |
illuminance | lux |
nlpcraft:city
This token denotes a city.
Additionally to nlpcraft:nlp:xxx
properties this type of token will have the following
metadata properties all of which are mandatory unless otherwise noted.
| Property | Java Type | Description |
|---|---|---|
nlpcraft:city:city |
java.lang.String |
Name of the city. |
nlpcraft:city:continent |
java.lang.String |
Continent name. |
nlpcraft:city:subcontinent |
java.lang.String |
Subcontinent name. |
nlpcraft:city:subcontinent |
java.lang.String |
Subcontinent name. |
nlpcraft:city:countrymeta |
java.util.Map |
Supplemental metadata for city's country (see below). |
nlpcraft:city:citymeta |
java.util.Map |
Supplemental metadata for city (see below). |
Following tables provides possible values for nlpcraft:city:countrymeta
map. The data is
obtained from The United Nations Statistics Division datasets:
| Key | Java Type | Description |
|---|---|---|
iso |
java.lang.String |
ISO country code. |
iso3 |
java.lang.String |
ISO 3166 country code. |
isocode |
java.lang.String |
ISO country code. |
capital opt. |
java.lang.String |
Optional country capital city name. |
area opt. |
java.lang.Double |
Optional country surface area. |
population opt. |
java.lang.Long |
Optional country population. |
continent |
java.lang.String |
Optional country continent. |
currencycode |
java.lang.String |
Country currency code. |
currencyname |
java.lang.String |
Country currency name. |
phone opt. |
java.lang.String |
Optional country phone code. |
postalcodeformat opt. |
java.lang.String |
Optional country postal code format. |
postalcoderegex opt. |
java.lang.String |
Optional country postal code regular expression. |
languages opt. |
java.lang.String |
Optional country list of languages. |
neighbours opt. |
java.lang.String |
Optional country list of neighbours. |
Following tables provides possible values for nlpcraft:city:citymeta
map. The data is
obtained from The United Nations Statistics Division datasets:
| Key | Java Type | Description |
|---|---|---|
latitude |
java.lang.Double |
City latitude. |
longitude |
java.lang.Double |
City longitude. |
population |
java.lang.Long |
City population. |
elevation opt. |
java.lang.Integer |
Optional city elevation in meters. |
timezone |
java.lang.String |
City timezone. |
nlpcraft:continent
This token denotes a continent.
Additionally to nlpcraft:nlp:xxx
properties this type of token will have the following
metadata properties all of which are mandatory unless otherwise noted.
| Property | Java Type | Description |
|---|---|---|
nlpcraft:continent:continent |
java.lang.String |
Name of the continent. |
nlpcraft:subcontinent
This token denotes a subcontinent.
Additionally to nlpcraft:nlp:xxx
properties this type of token will have the following
metadata properties all of which are mandatory unless otherwise noted.
| Property | Java Type | Description |
|---|---|---|
nlpcraft:subcontinent:continent |
java.lang.String |
Name of the continent. |
nlpcraft:subcontinent:subcontinent |
java.lang.String |
Name of the subcontinent. |
nlpcraft:metro
This token denotes a metro area.
Additionally to nlpcraft:nlp:xxx
properties this type of token will have the following
metadata properties all of which are mandatory unless otherwise noted.
| Property | Java Type | Description |
|---|---|---|
nlpcraft:metro:metro |
java.lang.String |
Name of the metro area. |
nlpcraft:region
This token denotes a geographical region.
Additionally to nlpcraft:nlp:xxx
properties this type of token will have the following
metadata properties all of which are mandatory unless otherwise noted.
| Property | Java Type | Description |
|---|---|---|
nlpcraft:region:region |
java.lang.String |
Name of the region. |
nlpcraft:region:continent |
java.lang.String |
Continent name. |
nlpcraft:region:subcontinent |
java.lang.String |
Subcontinent name. |
nlpcraft:region:subcontinent |
java.lang.String |
Subcontinent name. |
nlpcraft:region:countrymeta |
java.util.Map |
Supplemental metadata for region's country (see below). |
Following tables provides possible values for nlpcraft:region:countrymeta
map. The data is
obtained from The United Nations Statistics Division datasets:
| Key | Java Type | Description |
|---|---|---|
iso |
java.lang.String |
ISO country code. |
iso3 |
java.lang.String |
ISO 3166 country code. |
isocode |
java.lang.String |
ISO country code. |
capital opt. |
java.lang.String |
Optional country capital city name. |
area opt. |
java.lang.Double |
Optional country surface area. |
population opt. |
java.lang.Long |
Optional country population. |
continent |
java.lang.String |
Optional country continent. |
currencycode |
java.lang.String |
Country currency code. |
currencyname |
java.lang.String |
Country currency name. |
phone opt. |
java.lang.String |
Optional country phone code. |
postalcodeformat opt. |
java.lang.String |
Optional country postal code format. |
postalcoderegex opt. |
java.lang.String |
Optional country postal code regular expression. |
languages opt. |
java.lang.String |
Optional country list of languages. |
neighbours opt. |
java.lang.String |
Optional country list of neighbours. |
nlpcraft:country
This token denotes a country.
Additionally to nlpcraft:nlp:xxx
properties this type of token will have the following
metadata properties all of which are mandatory unless otherwise noted.
| Property | Java Type | Description |
|---|---|---|
nlpcraft:country:country |
java.lang.String |
Name of the country. |
nlpcraft:country:continent |
java.lang.String |
Continent name. |
nlpcraft:country:subcontinent |
java.lang.String |
Subcontinent name. |
nlpcraft:country:subcontinent |
java.lang.String |
Subcontinent name. |
nlpcraft:country:countrymeta |
java.util.Map |
Supplemental metadata for region's country (see below). |
Following tables provides possible values for nlpcraft:country:countrymeta
map. The data is
obtained from The United Nations Statistics Division datasets:
| Key | Java Type | Description |
|---|---|---|
iso |
java.lang.String |
ISO country code. |
iso3 |
java.lang.String |
ISO 3166 country code. |
isocode |
java.lang.String |
ISO country code. |
capital opt. |
java.lang.String |
Optional country capital city name. |
area opt. |
java.lang.Double |
Optional country surface area. |
population opt. |
java.lang.Long |
Optional country population. |
continent |
java.lang.String |
Optional country continent. |
currencycode |
java.lang.String |
Country currency code. |
currencyname |
java.lang.String |
Country currency name. |
phone opt. |
java.lang.String |
Optional country phone code. |
postalcodeformat opt. |
java.lang.String |
Optional country postal code format. |
postalcoderegex opt. |
java.lang.String |
Optional country postal code regular expression. |
languages opt. |
java.lang.String |
Optional country list of languages. |
neighbours opt. |
java.lang.String |
Optional country list of neighbours. |
nlpcraft:coordinate
This token denotes a latitude and longitude coordinate.
Additionally to nlpcraft:nlp:xxx
properties this type of token will have the following
metadata properties all of which are mandatory unless otherwise noted.
| Property | Java Type | Description |
|---|---|---|
coordinate:latitude |
java.lang.Double |
Coordinate latitude. |
coordinate:longitude |
java.lang.Double |
Coordinate longitude. |
nlpcraft:sort
This token denotes a sorting or ordering function.
Additionally to nlpcraft:nlp:xxx
properties this type of token will have the following
metadata properties all of which are mandatory unless otherwise noted.
| Property | Java Type | Description |
|---|---|---|
nlpcraft:sort:subjindexes |
java.util.List<Integer> |
One of more indexes of the target tokens (i.e. the token that being sorted). |
nlpcraft:sort:byindexes |
java.util.List<Integer> |
Zero or more (i.e. optional) indexes of the reference token (i.e. the token being sorted by). |
nlpcraft:sort:asc |
java.lang.Boolean |
Whether sorting is in ascending or descending order. |
nlpcraft:limit
This token denotes a numeric limit value (like in "top 10" or "bottom five").
Additionally to nlpcraft:nlp:xxx
properties this type of token will have the following
metadata properties all of which are mandatory unless otherwise noted.
| Property | Java Type | Description |
|---|---|---|
nlpcraft:limit:indexes |
java.util.List<Integer> |
Index (always only one) of the reference token (i.e. the token being limited). |
nlpcraft:limit:asc |
java.lang.Boolean |
Whether limit order is ascending or descending. |
nlpcraft:limit:limit |
java.lang.Integer |
Numeric value of the limit. |
nlpcraft:relation
This token denotes a numeric limit value (like in "top 10" or "bottom five").
Additionally to nlpcraft:nlp:xxx
properties this type of token will have the following
metadata properties all of which are mandatory unless otherwise noted.
| Property | Java Type | Description |
|---|---|---|
nlpcraft:relation:indexes |
java.util.List<Integer> |
Index (always only one) of the reference token (i.e. the token being related to). |
nlpcraft:relation:type |
java.lang.String |
Type of the relation. One of the following values:
|
google:xxx
These tokens denote xxx
that is a lower case name of the named entity
in Google APIs, i.e.
google:person
, google:location
, etc.
Additionally to nlpcraft:nlp:xxx
properties this type of token will have the following
metadata properties all of which are mandatory unless otherwise noted.
| Property | Java Type | Description |
|---|---|---|
google:salience |
java.lang.Double |
Correctness probability of this token by Google Natural Language. |
google:meta |
java.util.Map<String> |
Map-based container for Google Natural Language specific properties. |
google:mentionsbeginoffsets |
java.util.List<String> |
List of the mention begin offsets in the original normalized text. |
google:mentionscontents |
java.util.List<String> |
List of the mentions. |
google:mentionstypes |
java.util.List<String> |
List of the mention types. |
stanford:xxx
These tokens denote xxx
that is a lower case name of the named entity
in Stanford CoreNLP, i.e.
stanford:person
, stanford:location
, etc.
Additionally to nlpcraft:nlp:xxx
properties this type of token will have the following
metadata properties all of which are mandatory unless otherwise noted.
| Property | Java Type | Description |
|---|---|---|
stanford:confidence |
java.lang.Double |
Correctness probability of this token by Stanford CoreNLP. |
stanford:nne |
java.lang.String |
Normalized Named Entity (NNE) text. |
spacy:xxx
These tokens denote xxx
that is a lower case name of the named entity
in spaCy, i.e.
spacy:person
, spacy:location
, etc.
Additionally to nlpcraft:nlp:xxx
properties this type of token will have the following
metadata properties all of which are mandatory unless otherwise noted.
| Property | Java Type | Description |
|---|---|---|
spacy:vector |
java.lang.Double |
spaCy span vector. |
spacy:sentiment |
java.lang.Double |
A scalar value indicating the positivity or negativity of the token. |
opennlp:xxx
These tokens denote xxx
that is a lower case name of the named entity
in Apache OpenNLP, i.e.
opennlp:person
, opennlp:money
, etc.
Additionally to nlpcraft:nlp:xxx
properties this type of token will have the following
metadata properties all of which are mandatory unless otherwise noted.
| Property | Java Type | Description |
|---|---|---|
opennlp:probability |
java.lang.Double |
Correctness probability of this token by OpenNLP. |
nlpcraft:nlp
nlpcraft:date
nlpcraft:num
nlpcraft:city
nlpcraft:continent
nlpcraft:subcontinent
nlpcraft:region
nlpcraft:country
nlpcraft:metro
nlpcraft:coordinate
nlpcraft:sort
nlpcraft:limit
nlpcraft:relation
stanford:xxx
spacy:xxx
google:xxx
opennlp:xxx


Looking for some MIDI files? Try the Mutopia Project. I recommend the third part of Beethoven's Moonlight Sonata. The more variation your MIDI file has, the more interesting the graphics will be.
Nothing here yet, try adding something above!
Click "Playlist" in the nav top get started!
Note: all (non-percussion) notes are played with the piano due to limitations of the library
Note: the Visualize view may seem dull sometimes, but that's because many MIDI files don't have dynamics (volume)
Note: this can be a bit browser intensive sometimes... please go easy on Black MIDI
Uses code from:
Hey, your browser window is too small for this to work. Sorry.


Plugin Information |
|---|
No information for the plugin 'deploy-websphere' is available. It may have been removed from distribution. |
Overview
This plugin is an extension of the Deploy Plugin. It takes a war/ear file and deploys that to a running remote WebSphere Application Server at the end of a build.
The plugin currently supports:
- WebSphere Application Server 6.1 (with security disabled)
Installation
To run this plugin against a Jenkins installation, the following extra step need to be taken:
- The following WAS JAR files need to be placed into the Hudson class path or dropped into the %project.basedir%/WEB-INF/lib/ directory. These JAR files can be copied from the %WAS_HOME%/runtimes/ directory of your WAS server installation.
- com.ibm.ws.admin.client_6.1.0
- com.ibm.ws.webservices.thinclient_6.1.0
Failure to follow the above steps will mean the plugin will not operate.
User guide
Release Plan
- WebSphere Application Server 6.1/7 (with security disabled) (DONE)
- WebSphere Application Server 6.1/7 (with security enabled) (soon)
- WebSphere Portal Server 6.1 (soon)
Known Issues
Version history
Version 1.0 (Jun 2, 2010)
- Initial release : WebSphere Application Server 6.1 (with security disabled)
FAQ
How disable WAS security
- Open admin console: Start -> Programs -> IBM Websphere -> Application Server -> Profiles-> <SERVER_NAME> -> First Steps -> Administrative Console.
- Login and proceed: Security -> Secure administration, applications, and infrastructur.
- Clear "Enable administrative security" checkbox under Administrative security.
- Apply, save settings, restart WAS.
The plugin executes without exceptions but it does not do anything
This plugin depends on Deploy Plugin. The last version of the Deploy Plugin (1.5) seems to have some issue affecting also the Deploy WebSphere plugin. Downgrading the Deploy Plugin to version 1.4 should solve the problem.


| 1 | /* | |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
| 3 | * contributor license agreements. See the NOTICE file distributed with | |
| 4 | * this work for additional information regarding copyright ownership. | |
| 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
| 6 | * (the "License"); you may not use this file except in compliance with | |
| 7 | * the License. You may obtain a copy of the License at | |
| 8 | * | |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 10 | * | |
| 11 | * Unless required by applicable law or agreed to in writing, software | |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 | * See the License for the specific language governing permissions and | |
| 15 | * limitations under the License. | |
| 16 | */ | |
| 17 | package org.apache.commons.math3.exception; | |
| 18 | ||
| 19 | import org.apache.commons.math3.exception.util.Localizable; | |
| 20 | import org.apache.commons.math3.exception.util.ExceptionContext; | |
| 21 | import org.apache.commons.math3.exception.util.ExceptionContextProvider; | |
| 22 | ||
| 23 | /** | |
| 24 | * As of release 4.0, all exceptions thrown by the Commons Math code (except | |
| 25 | * {@link NullArgumentException}) inherit from this class. | |
| 26 | * In most cases, this class should not be instantiated directly: it should | |
| 27 | * serve as a base class for implementing exception classes that describe a | |
| 28 | * specific "problem". | |
| 29 | * | |
| 30 | * @since 3.1 | |
| 31 | * @version $Id: MathRuntimeException.java 1416643 2012-12-03 19:37:14Z tn $ | |
| 32 | */ | |
| 33 | public class MathRuntimeException extends RuntimeException | |
| 34 | implements ExceptionContextProvider { | |
| 35 | /** Serializable version Id. */ | |
| 36 | private static final long serialVersionUID = 20120926L; | |
| 37 | /** Context. */ | |
| 38 | private final ExceptionContext context; | |
| 39 | ||
| 40 | /** | |
| 41 | * @param pattern Message pattern explaining the cause of the error. | |
| 42 | * @param args Arguments. | |
| 43 | */ | |
| 44 | public MathRuntimeException(Localizable pattern, | |
| 45 | Object ... args) { | |
| 46 | context = new ExceptionContext(this); | |
| 47 | 1 | context.addMessage(pattern, args); |
| 48 | } | |
| 49 | ||
| 50 | /** {@inheritDoc} */ | |
| 51 | public ExceptionContext getContext() { | |
| 52 | 1 | return context; |
| 53 | } | |
| 54 | ||
| 55 | /** {@inheritDoc} */ | |
| 56 | @Override | |
| 57 | public String getMessage() { | |
| 58 | 1 | return context.getMessage(); |
| 59 | } | |
| 60 | ||
| 61 | /** {@inheritDoc} */ | |
| 62 | @Override | |
| 63 | public String getLocalizedMessage() { | |
| 64 | 1 | return context.getLocalizedMessage(); |
| 65 | } | |
| 66 | } | |
Mutations | ||
| 47 |
removed call to org/apache/commons/math3/exception/util/ExceptionContext::addMessage : NO_COVERAGE |
|
| 52 |
mutated return of Object value for org/apache/commons/math3/exception/MathRuntimeException::getContext to ( if (x != null) null else throw new RuntimeException ) : NO_COVERAGE |
|
| 58 |
mutated return of Object value for org/apache/commons/math3/exception/MathRuntimeException::getMessage to ( if (x != null) null else throw new RuntimeException ) : NO_COVERAGE |
|
| 64 |
mutated return of Object value for org/apache/commons/math3/exception/MathRuntimeException::getLocalizedMessage to ( if (x != null) null else throw new RuntimeException ) : NO_COVERAGE |


Amnesty™ Hypercube is an OpenSocial application for MySpace that allows you to collect and share web widgets with your friends. What's a web widget? A web widget is a mini-application that is supposed to be embedded inside a blog or home page. Examples include photo slideshows, streaming audio players, flash games and embeddable video.
If you've already installed Hypercube, you need to login before using it.
Otherwise, you can install Hypercube and login from Hypercube's application profile page.


--- layout: page title: "About" description: "This page is pretty much worthless." header-img: "img/about-bg.jpg" ---
This site is supposed to be dedicated to producing high quality and in depth technical content for Xamarin.Forms. It is written by Jason Smith, the lead programmer of the product.  It will however contain lots of neat tips and tricks.
In reality this is more than likely going to be a collection of random thoughts, ramblings, and snippets of code about whatever happens to be on my mind as I'm making the product.


doufu
on 2012-09-24 11:04:55
thanks
Soulcyon
on 2011-04-07 09:09:32
s = utf8(s);
var t = "PUT THAT HUGE TABLE IN HERE",
c = 0,
i = -1,
l = str.length - 1;
c = c ^ -1;
while( !!(i++ - l) )
c = ( c >>> 8 ) ^ parseInt(t.substr( (c ^ s.charCodeAt(i) & 255) * 9, 8 ), 16);
return c ^ -1;
Rafa? Kukawski
on 2011-03-20 16:08:55
@Benny Nissen: thanks for your report. The problem was inside utf8_encode function, that for null value didn't return empty string. This is now fixed in git.
Benny Nissen
on 2011-03-20 12:19:10
Passing 'null' (javascript null) gived different values on the client and server side. I pass the value as JSON so it might get 'translated' somewhere. Just to let somebody know.
Benny
Marco
on 2011-02-18 11:06:55
This function solves the bug that i've posted: http://stackoverflow.com/questions/2647935/javascript-crc32-function-and-php-crc32-not-matching
Marco
on 2011-02-18 10:49:55
I think i've found a bug for this one.
Input string: "\x49\x44\x41\x54\x08\x1d\x01\x05\x00\xfa\xff\x00\x79\x00\x00\xff\x02\xe8\x01\x79" (it's a substring of a png file).
PHP crc: -1895555446
JS crc: 756484124
Kevin van Zonneveld
on 2008-04-06 10:50:51
@ T0bsn: I've updated the function. Thanks a lot!!
T0bsn
on 2008-04-04 19:22:33
replace:
if (typeof(crc) == "undefined") { crc = 0; }
with:
var crc;
...and it works for every function exec. ;)


Referee controversy as SA defeated by Egypt in U-23 AFCON
Johannesburg - Egypt and the Ivory Coast secured places on Tuesday at the 2020 Tokyo Olympic Games football tournament after contrasting qualifying tournament semi-finals victories in Cairo.
Abdel Rahman Magdy scored two late goals to complete a 3-0 triumph for Egypt over South Africa after captain Ramadan Sobhy had broken the deadlock by converting a 59th-minute penalty.
The referee controversially pointed to the penalty spot despite the South African defender being clearly outside of the box which gave Egypt an undeserved lead.
Egyptian footballers last appeared at the Olympics seven years ago in London, where they fell to Japan in the quarter-finals.
The victory over South Africa maintained a perfect record by the host nation in the qualifying tournament after one-goal group victories over Mali, Ghana and Cameroon.
Ivory Coast edged Ghana 3-2 in a penalty shootout following a 2-2 draw after extra time to secure a second qualification for the Olympics, having reached the 2008 quarter-finals.
Youssouf Dao twice put the Ivorians ahead in regulation time and the second Ghana equaliser came from Evans Mensah in the second minute of stoppage time.
Ghana had several chances to win the match in extra time while Czech Republic-based Dao fluffed a last-minute opportunity to complete his hat-trick.
The shootout was won by the Ivorians when a weak fifth Ghanaian spot-kick from Owusu Kwabena was saved by Eliezer Tape Ira.
Africa has been allocated three places at the Tokyo Games and the third slot will go to the winners of a play-off between Ghana and South Africa this Friday.
There have been five Olympics football medallists from Africa with Nigeria winning gold, silver and bronze, Cameroon gold and Ghana bronze.


{{response.title = "Ship Spinning Inc."}}
{{extend "layout.html"}}
Ship Spinning Inc. is a browser-based slot machine for Eve Online. Use your in-game ISK to spin for prizes! For more info, check out the FAQ and our 90% payout promise.
by {{=newspost.author.charname}} at {{=newspost.date}}
| Player | Prize |
|---|---|
| {{=winner.char.charname}} | {{=winner.prize.name}} |


Binary search is not hard to understand. It is rather hard to apply. Sometimes, you can’t even link a question with binary search. In another article Longest Increasing Subsequence, we could even apply binary search in a poker game.
Let’s discuss another interesting question that we can use binary search: how to determine if a given string
s
is subsequence of another string t
(assume s
is much shorter as compared to
t
)? Look at the two examples below:
s = “abc”, t = “ahbgdc”, return true.
s = “axc”, t = “ahbgdc”, return false.
This is a straightforward question which looks simple. But can you relate this with binary search?
Here is an intuitive solution:
bool isSubsequence(string s, string t) {
int i = 0, j = 0;
while (i < s.size() && j < t.size()) {
if (s[i] == t[j]) i++;
j++;
}
return i == s.size();
}
The idea is to use two pointers i, j
to point to s, t
respectively. While moving forward,
try to match the characters:
Some people may claim this is the optimal solution, given the time complexity is O(N) while N is the length of
t
.
In fact, this solution is good enough for this problem alone. However, there is a follow-up:
Given a list of string s1,s2,...
and a string t
, determine if each string s
is a subsequence of t
(assume each s
is much shorter as compared to t
).
We can still apply the same logic inside a for
loop. However, the time complexity for each
s
is still O(N). If binary search is applied, the time complexity can be reduced to O(MlogN). Since
N >> M
, the efficiency will be improved significantly.
To begin with binary search, we need to pre-process t
by storing the indices of each character in a
dictionary index
.
int m = s.length(), n = t.length();
ArrayList<Integer>[] index = new
ArrayList[256];
// record down the indices of each character in t
for (int i = 0; i < n; i++) {
char c = t.charAt(i);
if (index[c] == null)
index[c] = new ArrayList<>();
index[c].add(i);
}
Refer to the diagram below, since we’ve matched “ab”, the next one to be matched should be “c”:
If we apply the first solution, we need to traverse linearly using j
to find “c”. With the information
in index
, we can use binary search to find an index that is greater than j
in
index["c"]
. In the diagram above, we need to find an index from [0, 2, 6]
that
is greater than 4:
In this way, we can directly get the index of next “c”. The problem becomes how to find the smallest index that is greater than 4? We can use binary search to find the left boundary.
In another article Detailed Binary Search,
we discussed in details how to implement binary search in 3 different ways. When we use binary search to return the
index of target val
to find the left boundary, there is a special property:
When val
does not exist, the index returned is the index of the smallest value which is
greater than val
.
It means that when we try to find element 2 in array [0,1,3,4]
, the algorithm will return index 2,
where element 3 is located. And element 3 is the smallest element that is greater than 2 in this array. Hence, we
can use binary search to avoid linear traversal.
// binary search to find the left boundary
int left_bound(<> arr, int
tar) {
int lo = 0, hi = arr.size();
while (lo < hi) {
int mid = lo + (hi - lo) / 2;
if (tar > arr.get(mid)) {
lo = mid + 1;
} else {
hi = mid;
}
}
return lo;
}
The binary search above is to find the left boundary. Its details can be found in Detailed Binary Search. Let’s apply it.
We take a single string s
as an example for the case of multiple strings. The part of pre-processing
can be extracted out.
boolean isSubsequence( s, t) {
int m = s.length(), n = t.length();
// pre-process t
ArrayList<Integer>[] index = new
ArrayList[256];
for (int i = 0; i < n; i++) {
char c = t.charAt(i);
if (index[c] == null)
index[c] = new ArrayList<>();
index[c].add(i);
}
// the pointer in t
int j = 0;
// find s[i] using index
for (int i = 0; i < m; i++) {
char c = s.charAt(i);
// character c does not exist in t
if (index[c] == null) return false;
int pos = left_bound(index[c], j);
// c is not found in the binary search interval
if (pos == index[c].size()) return false;
// increment pointer j
j = index[c].get(pos) + 1;
}
return true;
}
The gif below illustrates how the algorithm executes:
We can see that the efficiency can be significantly improved using binary search.


« CSS « CSS Reference
The :checked
pseudo-class selector represents any radio (<input type="radio">
) or checkbox (
<option>
in a
<select>
) element that is checked or toggled to an on
state. The user can change this state by clicking on the element, or selecting a different value, in which case the :checked
pseudo-class no longer applies to this element, but will to the relevant one.
element:checked { style properties }
input[type="radio"]:checked


Top cops hits out after attacks on his officers
Chief Inspector Brian Anderson has condemned a series of attacks on his officers — which saw one taken to hospital with alleged bite marks on their arm.
by Paul Behan, https://www.dailyrecord.co.uk/authors/paul-behan/Four of his serving officers were subjected to assaults by members of the public.
The Post has learned that the assaults took place late last month as hard-working officers were in the execution of their duty.
In one incident a cop was hospitalised.
Thankfully, the officer who was the alleged victim of the bite to their arm, was back on duty the following day.
News of the incidents follows recent media coverage of attacks on police, which have more than doubled since the formation of Police Scotland six years ago.
Locally, Ayrshire has seen one of the highest increases on police attacks.
In the first year of the unified force, 778 attacks were carried out on officers and civilian staff across the country in the last 12 months, the number of assaults has risen to 1685 – an increase of 52 per cent in six years.
The figures, released by Police Scotland under freedom of information, also show that the two areas which recorded the next highest number of police assaults were Ayrshire and Glasgow- with 189 attacks each.
CI Anderson shared his disappointment on social media.
He said: “Disappointed to come to work to find four officers subject of assaults overnight, with one requiring hospital treatment after allegedly being bitten on the arm.
“Officers do not come to work to be assaulted- it’s not in the job description! Those who do assault cops end up in one place.”


CSS Only
CSS Only
Perspective
Perspective
Text Effect
Text Effect
by
by
James
James
Bosworth
Bosworth


{%- include head.html -%}
{%- include nav.html -%}
{%- include post_header.html -%}
{{ content }}
Please Share Thoughts
Comment
{%- include footer.html -%}
Please Share Thoughts


:: com :: sun :: star :: frame ::
|
| interface XDispatchInformationProvider |
|
- Description
- provides information about supported commands
This interface can be used to retrieve additional information about
supported commands. This interface is normally used by configuration
implementations to retrieve all supported commands.
A dispatch information provider is normally supported by a
Frame service.
- Since
- OOo 2.0
- See also
- Frame
|
| Methods' Details |
getSupportedCommandGroups
| sequence< short > |
| getSupportedCommandGroups(); |
- Description
- returns all supported command groups.
- Returns
- a sequence of supported command groups.
- See also
- CommandGroup
|
|
getConfigurableDispatchInformation
- Description
- returns additional information about supported commands of a
given command group.
- Parameter CommandGroup
- specifies a command group.
- Returns
- name and group name of every command supported. A group ID which is
not supported returns an empty com::sun::star::uno::Sequence.
|
|
Top of Page
Copyright © 2013, The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the Apache feather logo, Apache OpenOffice and OpenOffice.org are trademarks of The Apache Software Foundation. Other names may be trademarks of their respective owners.


Your room is running!
Test out your room...
GameOn! Swift chatroom
{{m.content}}
{{m.origin}}
{{m.content}}
{{m.origin}}
Poke your room with a test message:
Hello room
Goodbye room
Join room
What next?
Use the top half of this page for the equivalent of poking your room with a stick
Use the
/listmyrooms
command in First Room to find your live room in the game
Add custom commands and items to your room (see
Sources/SwiftRoom/RoomImplementation.swift
)
Scale your service -- does that change how you manage state?
Check out other
Advanced Adventures
Learn about the game's
Application architecture
Go play! Game On!


We assume that we don't know the precise form of the program that output the information, although it's useful to guess it's FORTRAN and assume that most output is column-formattted. This means that fields can run together. For example MDL Molfiles have (3I3) for the bond numbers and orders giving an output like:
1 2 1 2 3 1However with 100 or more atoms the fields run together, e.g. atom 102 bonded to 121 would be:
101121 1so that relying on whitespace would fail. However in most cases whitespace-parsing can be used and is easier than counting the column numbers - but you will will probably need both
It's worth looking at a small number of files to see how much they vary. JUMBOParsers don't have to be complete or completely correct at first and we can add new details when we get more documents. In general we start simple and add more details as we get a better understanding.
We'll use the same file as before:
MASS BOND cq-ca 428.1 1.397 k (3_2: 5 points @0.01A == 0-1 Kcal), dist from mp2/6-31G* c2-cq 330.1 1.461 k (1_2: 5 points @0.01A == 0->1.2 Kcal) dist from mp2/6-31G* c2-cd 364.0 1.424 k (1_16: 10 points @0.01A == 0->3.5 Kcal) dist from mp2/6-31G* cc-nh 495.0 1.352 k (33_28: 5 points @0.01A == 0->1.5 Kcal) dist from mp2/6-31G* ANGLE cd-c2-cd 100.211 121.085 k (16_1_25: 5 points at 1 degree 0->0.8 Kcal) angle from mp2/6-31G* cd-c2-cq 102.736 119.194 k (25_1_2: 5 points at 1 degree 0->0.8 Kcal) angle from mp2/6-31G* c2-cq-ca 102.012 120.340 k (1_2_3: 5 points at 1 degree 0->0.8 Kcal) angle from mp2/6-31G* c3-nh-c3 119.542 119.218 k (47_33_43: 5 points at 1 degree 0->0.9 Kcal) angle from mp2/6-31G* DIHE cd-cd-c2-cq 1 2.0 236.4 2. cd-c2-cd-cd 1 2.0 236.4 2. cd-c2-cq-ca 1 1.5 268.6 2. c3-nh-cc-cc 4 14.500 180.000 2.000 (X -ca-ca-X) IMPROPER NONBONHere's how I think about a simple parser.
Parsers are based on templates which attempt to identify "chunk"s of information and extract the free text into them. Not surprisingly the whole parser is a single template, and templates can be nested and referenced so the approach is very flexible. The simplest parser (amber.minimal.template.xml)is therefore:
<template id="amber"> </template>Run:
amber.minimal.template.xml
on amber.inp
=> amber.minimal.out.xml
The output (cut down) is:
<module cmlx:templateRef="amber.minimal.example" xmlns="http://www.xml-cml.org/schema" xmlns:cmlx="http://www.xml-cml.org/schema/cmlx" >MASSBONDcq-ca 428.1 1.397 k (3_2: 5 points @0.01A == 0-1 Kcal), dist from mp2/6-31G*c2-cq 330.1 ... IMPROPERNONBON</module>Note:
We now look at how to split the file into the natural chunks. Our current example is straightforward; it's easy to see where the blocks are and also easy to write a template. To create a template we need:
For all except the simplest files we need to nest templates, if necessarily to 3 or even more levels. The general structure is:
<template id="top"> <templateList> <template id="level1.1">...</template> <template id="level1.2">...</template> <template id="level1.3"> <templateList> <template id="level1.3.1">...</template> <template id="level1.3.2">...</template> </templateList> </template> </templateList> </template>and these will produce nested modules. Note that one template can, with an indefinite repeat count, produce many cml:modules.
The next step is to create nested templates (amber.chunk.template.xml) that represent the chunk structure:
<template id="amber.example"> <templateList> <template id="angle" pattern="ANGLE" endPattern="\s*"> <comment class="example"> cd-c2-cd 100.211 121.085 k (16_1_25: 5 points at 1 degree 0->0.8 Kcal) angle from mp2/6-31G* </comment> </template> <template id="bond" pattern="BOND" endPattern="\s*"> <comment class="example"> cq-ca 428.1 1.397 k (3_2: 5 points @0.01A == 0-1 Kcal), dist from mp2/6-31G* </comment> </template> <template id="dihed" pattern="DIHE.*" endPattern="\s*"> <comment class="example"> c3-nh-cc-cc 4 14.500 180.000 2.000 (X -ca-ca-X) </comment> </template> <template id="improper" pattern="IMPR.*" endPattern="\s*"/> <template id="mass" pattern="MASS" endPattern="\s*"/> <template id="nonbond" pattern="NONB.*" endPattern="\s*"/> </templateList> </template>The comment elements have an important purpose. Not only do they contain examples which help to remind the author but they also support unit tests as we shall see. We'll explain the Patterns and their regular expressions later.
Run this
amber.chunk.template.xml on amber.inp => amber.chunk.out.xml
Here's the result (amber.chunk.out.xml)
<module cmlx:templateRef="amber.example" xmlns="http://www.xml-cml.org/schema" xmlns:cmlx="http://www.xml-cml.org/schema/cmlx"> <module cmlx:lineCount="1" cmlx:templateRef="mass">MASS</module> <module cmlx:lineCount="5" cmlx:templateRef="bond">BONDcq-ca 428.1 1.397 k (3_2: 5 points @0.01A == 0-1 Kcal), dist from mp2/6-31G*c2-cq 330.1 1.461 k (1_2: 5 points @0.01A == 0->1.2 Kcal) dist from mp2/6-31G*c2-cd 364.0 1.424 k (1_16: 10 points @0.01A == 0->3.5 Kcal) dist from mp2/6-31G*cc-nh 495.0 1.352 k (33_28: 5 points @0.01A == 0->1.5 Kcal) dist from mp2/6-31G* </module> <module cmlx:lineCount="5" cmlx:templateRef="angle">ANGLEcd-c2-cd 100.211 121.085 k (16_1_25: 5 points at 1 degree 0->0.8 Kcal) angle from mp2/6-31G*cd-c2-cq 102.736 119.194 k (25_1_2: 5 points at 1 degree 0->0.8 Kcal) angle from mp2/6-31G*c2-cq-ca 102.012 120.340 k (1_2_3: 5 points at 1 degree 0->0.8 Kcal) angle from mp2/6-31G*c3-nh-c3 119.542 119.218 k (47_33_43: 5 points at 1 degree 0->0.9 Kcal) angle from mp2/6-31G*</module> <module cmlx:lineCount="5" cmlx:templateRef="dihed">DIHEcd-cd-c2-cq 1 2.0 236.4 2.cd-c2-cd-cd 1 2.0 236.4 2.cd-c2-cq-ca 1 1.5 268.6 2.c3-nh-cc-cc 4 14.500 180.000 2.000 (X -ca-ca-X)</module> <module cmlx:lineCount="1" cmlx:templateRef="improper">IMPROPER</module> <module cmlx:lineCount="1" cmlx:templateRef="nonbond">NONBON</module>Note:


Find Dialog
Find Dialog | - Search and replace in edit windows
FORMS
This dialog allows one to search in whatever window is top-most, and to carry
out replacements in editor windows. If the text which has been typed into the Search for: box is located, the window containing it is adjusted so that the sought-for
text is approximately centered vertically, and the text is highlighted.


Generating Chart
Activities By Day
Generating Chart
Activities By User
Generating Chart
Activities By Each User


html>
Because this HTA includes an X-UA-Compatible header, it is displayed in IE9 Standards mode when Internet Explorer 9 is installed on the system. As a result, SVG can be used to draw a blue star.


|
Vector-Synthesizer
1.5
A Vector-Synthesizer like the Prophet VS!
|
Applies a 4-stage low-pass filter to a sample. More...
#include <moogLadderFilter.h>
Public Types | |
| enum | { LPF1, HPF1, LPF2, HPF2, BPF2, BSF2, LPF4, HPF4, BPF4 } |
Public Member Functions | |
| MoogLadderFilter () | |
| Filter with default SampleRate 48kHz and cut-off at 10kHz. | |
| void | reset () |
| Reset all four LPF. | |
| void | setResonance (float K) |
| Set the resonance off the filter. More... | |
| void | calculateAlpha_0 () |
| Re-calculates alpha value. Only needed after setting resonance. | |
| void | setFilter (unsigned int type) |
| void | setCutOff (float Fc) |
| Set new Cut-off frequency. This function calls update(). More... | |
| void | update () |
| Updates all parameters used by the filter. This is an very expensive call! | |
| float | doFilter (float xn) |
| Applies filter to given sample. More... | |
| void | doFilter (float *xn) |
| Applies filter to given sample. Uses call-by-ref. More... | |
Public Attributes | |
| Filter | m_LPF1 |
| First LPF. | |
| Filter | m_LPF2 |
| Second LPF. | |
| Filter | m_LPF3 |
| Third LPF. | |
| Filter | m_LPF4 |
| Fourth LPF. | |
| float | m_dK |
| K, set with Q. | |
| float | m_dGamma |
| see block diagram | |
| float | m_dAlpha_0 |
| see block diagram | |
| float | m_dA |
| Oberheim Xpander A-coefficient. | |
| float | m_dB |
| Oberheim Xpander B-coefficient. | |
| float | m_dC |
| Oberheim Xpander C-coefficient. | |
| float | m_dD |
| Oberheim Xpander D-coefficient. | |
| float | m_dE |
| Oberheim Xpander E-coefficient. | |
| float | m_dFc |
| Cut-off frequency. | |
| unsigned int | m_dSampleRate |
| sample rate | |
| unsigned int | m_uFilterType = LPF4 |
| Selected filter type. | |
| const float | TWO_PI = 2.0*M_PI |
Applies a 4-stage low-pass filter to a sample.
This class applies a 4-stage low-pass filter to a sample. The filter is inspired by Moog Ladder Filter with Oberheim Xpander variations as described in: Designing Software Synthesizer Plug-Ins in C++, Page 404, 7.6 Moog Ladder Filter Model
Contact: c.jae dick e@mat h.tu -berl in.d e
| float MoogLadderFilter::doFilter | ( | float | xn | ) |
Applies filter to given sample.
| xn | Sample |
| void MoogLadderFilter::doFilter | ( | float * | xn | ) |
Applies filter to given sample. Uses call-by-ref.
| xn | Pointer to sample |
| void MoogLadderFilter::setCutOff | ( | float | Fc | ) |
Set new Cut-off frequency. This function calls update().
| Fc | Cut-off frequency. Has to be <= 10kHz |
| void MoogLadderFilter::setResonance | ( | float | K | ) |
Set the resonance off the filter.
| K | Factor with values between 1..4 |


| Total net profit | -17.92 | Gross profit | 37.46 | Gross loss | -55.38 |
| Profit factor | 0.68 | Expected payoff | -0.33 | ||
| Absolute drawdown | -22.13 | Maximal drawdown (%) | 30.58 (361.89%) | ||
| Total trades | 55 | Profit trades (% of total) | 27 (49.09%) | Loss trades (% of total) | 28 (50.91%) |
| Long positions (won %) | 33 (54.55%) | Short positions (won %) | 22 (40.91%) | ||
| Largest | profit trade | 3.74 | loss trade | -3.33 | |
| Average | profit trade | 1.39 | loss trade | -1.98 | |
| Minimum | profit trade | 0.43 | loss trade | -0.25 | |
| Maximum | take profit in pips | 53.5 | stop loss in pips | -35.4 | |
| Average | take profit in pips | 15.6 | stop loss in pips | -24.8 | |
| Minimum | take profit in pips | -2.5 | stop loss in pips | -3.1 | |
| Maximum | Reward-Risk | 5.0 | Duration in minutes | 1286 | |
| Average | Reward-Risk | 0.8 | Duration in minutes | 190.1 | |
| Minimum | Reward-Risk | 0.0 | Duration in minutes | 0 | |
| Maximum | consecutive wins (profit in money) | 2.0 (7.23) | consecutive losses (loss in money) | 6.0 (-14.1) | |
| Average | consecutive wins | 1.0 | consecutive losses | 1.0 |
| Total net profit | -8.93 | Gross profit | 21.95 | Gross loss | -30.88 |
| Profit factor | 0.71 | Expected payoff | -0.27 | ||
| Absolute drawdown | -13.14 | Maximal drawdown (%) | 17.38 (409.91%) | ||
| Total trades | 33 | Profit trades (% of total) | 18 (54.55%) | Loss trades (% of total) | 15 (45.45%) |
| Largest | profit trade | 3.63 | loss trade | -3.08 | |
| Average | profit trade | 1.22 | loss trade | -2.06 | |
| Minimum | profit trade | 0.43 | loss trade | -0.25 | |
| Maximum | take profit in pips | 41.8 | stop loss in pips | -35.4 | |
| Average | take profit in pips | 15.2 | stop loss in pips | -26.3 | |
| Minimum | take profit in pips | -2.5 | stop loss in pips | -9.0 | |
| Maximum | Reward-Risk | 3.9 | Duration in minutes | 783.0 | |
| Average | Reward-Risk | 0.7 | Duration in minutes | 231.8 | |
| Minimum | Reward-Risk | 0.0 | Duration in minutes | 0.0 | |
| Maximum | consecutive wins (profit in money) | 3.0 (2.4) | consecutive losses (loss in money) | 4.0 (-7.68) | |
| Average | consecutive wins | 1.0 | consecutive losses | 1.0 |
| Total net profit | -8.99 | Gross profit | 15.51 | Gross loss | -24.5 |
| Profit factor | 0.63 | Expected payoff | -0.41 | ||
| Absolute drawdown | -8.99 | Maximal drawdown (%) | 14.66 (258.55%) | ||
| Total trades | 22 | Profit trades (% of total) | 9 (40.91%) | Loss trades (% of total) | 13 (59.09%) |
| Largest | profit trade | 3.74 | loss trade | -3.33 | |
| Average | profit trade | 1.72 | loss trade | -1.88 | |
| Minimum | profit trade | 0.53 | loss trade | -0.32 | |
| Maximum | take profit in pips | 53.5 | stop loss in pips | -34.2 | |
| Average | take profit in pips | 16.3 | stop loss in pips | -22.6 | |
| Minimum | take profit in pips | 3.7 | stop loss in pips | -3.1 | |
| Maximum | Reward-Risk | 5.0 | Duration in minutes | 1286.0 | |
| Average | Reward-Risk | 0.9 | Duration in minutes | 127.5 | |
| Minimum | Reward-Risk | Duration in minutes | 7.0 | ||
| Maximum | consecutive wins (profit in money) | 3.0 (5.2) | consecutive losses (loss in money) | 6.0 (-6.14) | |
| Average | consecutive wins | 1.0 | consecutive losses | 2.0 |


---
title: Personas, interview and sketches for the website
---
Interview with the owner
About Chun Kee
- Chun Kee is one of the oldest Guangdong noodle factories in Hong Kong Island.
- Compared to other noodle factories, Chun Kee is the only factory tha still uses traditional Chinese making methods. Many other factories have been transfered from the owners to other people who are without any noodle making knowledge. They use auto machines to make noodles now. Chun Kee still uses hand (with help of the machines) to make noodle.
- Chun Kee Noodle Factory was commenced by Fan Chun in 1965, and has been inherited by him since Fan Chun passed away.
- Chun Kee was originally located at 136 Sai Wan Ho and moved to 30 Hing Man St in 1975.
Expectation of the website
- showing the historical and vintage aspect of Chun Kee on the homepage, and the product pages can be more modern.
- What are vintage and historical feelings to you?: old black and white photos
- He wants the website can display Chinese and English at the same time, which can show that Chun Kee is more internationalised now.
- Easy to use
- can be used on mobile phone
Photos of the noodles
I have received all of them.
Information of the noodles
He will give me soon...
Chun Kee website users persona
Owner Persona
Fan Yun Kat
- Age: 55 years
- Gender: male
- Job: Owner of Chun Kee noodle factory
- Skill:
- manage the noodle shop
- make Chinese noodle
- Computer skill: seldom uses computer
- using digital media: he only uses his phone for Whatsapp, watching news on Apple daily app
- Goal:
- He would like to have a website for his shop to promote his noodle.
- He mainly wants to put media coverage of the shop and photos of the shop 50 years ago on the website, which can show that Chun Kee noodle shop has a long history and good reputation.
- He does not want to have an online store. Information of ingredients, cooking methods of noodle only.
- He wants to display English and Chinese on the webpages at the same time, as he can never find the translating button on a webpage.
- He wants the website be simple as most of the customers of the shop are middle-aged to old-aged, the website should be easily navigated.
Customers' persona
Lee chi chun
- Age: 53 years
- Gender: Female
- Job: housewife
- Skill:
- cooking
- taking care of her son, managing all the household work
- computer skill: seldom uses computee
- Goal:
- Would like to buy Chun Kee noodle for her family
- Habit:
- go to the actual store to buy noodle
- uses mobile phone for watching Korean drama
- Experiences
- She has bought Chun Kee noodle for 10 years.
- She found that the price was rised after going to the shop.
- mobile experiences: not very much
After doing these personas and interview, I think the website will be simple and easily be navigated as the target audiences are middle-aged people to the elderly. This website should be focusing on the historical images of the shop, as it is the significant point of Chun Kee.
Sketches of the websites
Here are the sketches of the website. There are Chinese descriptions of the website in the first photo. Most of the sketches are mobile websites, as the users are going to use the website on mobile phone, so the design of the website will be mobile first


15 Dec 2017
Introduction This post aims at comparing two different pieces of hardware that are often used for Deep Learning tasks. The first is a GTX 1080 Ti GPU, a gaming device. The second is a Tesla P100 GPU, a high-end device devised for data centers which provides high-performance computing for Deep Learning. Hardware The hardware specifications of both the devices are:...
12 Dec 2017
What is Functional Programming? Programming paradigm The programming paradigms can be roughly divided into four categories, namely the imperative programming, where you specify do this, do that, then do this. Python is an imperative language. The second category is object oriented programming, where you model your data in the form of classes, objects and methods. Java, C++ and even Python...
25 Nov 2017
When I started to look into the Fedora’s 389 Directory Server, my first concern was understanding LDAP glossary! I did a project of Single Sign-On and Password Authentication using LDAP as the database during my internship in the last year of undergraduation, 2+ years back (time literally flies!), but to be honest, I didn’t really understand much at that time....
25 Nov 2017
Recently I came across a problem in which I had to convert .evtx files (Windows Event Log files) to a human readable format like XML, CSV, JSON etc. There’s this popular and only working parser that I know about python-evtx. It parses .evtx files to XML format. These are the steps which I followed: Clone the python-evtx directory in your...
20 Nov 2017
This post is about the talk I gave in PyLadies Melbourne meetup on 20th Nov'17. I gave a beginner introduction to Machine Learning, the common methods and evaluation metrics. Here is the PDF. I have attached below the pdfs of 'Knowledge Technologies' subject lectures, projects and sample exam papers, which introduces the concepts of information retrieval, machine learning and data...


{% extends "base.html" %} {% block content %}
Sentiment Analysis (SA) aims to determine the attitude of a speaker, writer, or other subject with respect to some topic or the overall contextual polarity or emotional reaction to a document, interaction, or event. Sentiments can be expressed in binary or multi-class form. Binary sentiment classification includes positive and negative class while multi-class sentiment classification consists of more than two classes, i.e., positive, highly positive, negative, highly negative and neutral etc. This system classifies the sentences or documents of Hindi text into three classes such as positive, negative and neutral
It determines whether each sentence expressed a positive, negative, or neutral opinion.
Document level considers that a document is an opinion on an entity or aspect of it. The task is to classify whether a whole opinion document expresses a positive or negative sentiment. For example, given a product review, the system determines whether the review expresses an overall positive or negative opinion about the product.
e mauris. Aliquam varius eleifend odio ac suscipit. Integer eu libero sed odio varius mattis. Aliquam hendrerit sagittis dolor, at finibus est tincidunt accumsan. Nullam congue purus id turpis consequat, quis varius nunc ornare.


I'm a Costa Rican software dev with an M.Sc. in Computer Science from
ITCR, currently data science and engineering lead at
Growth Acceleration Partners and professor for the analytics post-graduate program at
Cenfotec University. I enjoy traveling,
making games and spreading the love for open software/hardware.
{% for post in site.posts limit:4 %}
- {{ post.date | date_to_string }} » {{ post.title }}
{% endfor %}


/*
Note:
1. The reason is that auto_ptr will free the content using delete instead of delete[],
and so auto_ptr is not suitable for handling heap-allocated arrays (constructed with new[])
and is only suitable for handling single, heap-allocated arrays that were constructed with new.
2. Supporting operator[] would encourage developers to use it for arrays and would mistakenly give
the impression that the type can support arrays when, in fact, it cannot.
3. If you want a smartpointer-like array class, use boost::scoped_array.
*/


--- layout: post title: iPods vs Phones date: 2005-02-21 00:00:00 category: mobile ---
The iPod vs MP3 phones: "If the Apple products outsell these - and they will - it won't be because of the huge capacity. It will be the user interface. Nobody has shown anything like a competent alternative yet."