Dictionary Features

A Feature is a variable associated with a link in the Text Graph. The features of a link can be viewed using the Text Graph analyser. Here's an example:

The analyser output shows the link identifier in the text block and the probability associated with the link, together with a feature for whether the item is plural or not.

The Dictionary that generated those features is:

#wordlist tag:Mywordlist
police
#feature:plural true
police officers
weapons
#feature:plural false
pistol
firearm
assailant
victim

Features can take any of the following Java-based data types:

The data-type defaults to string if it is not specified.

Setting and clearing features

The command for setting a feature name to a value for all subsequent entries in a Dictionary is:

#feature:feature-name[:data-type] value

The feature-name and data-type should be specified when setting feature.

For example:

#feature:myfeature:long 1013

will add the feature myfeature of type long and set its value to 1013 for all following entries until the next #wordlist is defined.

If a feature of the same name is given a new value, the new value supersedes the earlier value.

The feature can be deleted for subsequent entries using:

#clear feature:feature_name

#clear feature:feature_name

A longer example

The following example is provided for you to try out in the demonstration Dictionaries distributed with Sintelix.

/*
#EXAMPLE
hello!, hello-world, true-world, truth, helloworld, no-feature
#EXAMPLE END
*/
#wordlist Demo2-Feature
#feature:name1 hello
// #feature is equivalent to #feature:string
hello! // output features {name1: "hello"}
#feature:name2:string world
hello-world // has two features {name1: "hello", name2: "world"}
// features of the same name do not stack - the old feature is replaced
#feature:name1:boolean true
true-world // has two features {name1: true, name2: "world"}
// note that "true" and "false" are interpreted as a boolean types
#clear feature:name2 // clear feature name2
truth // now has only 1 feature {name1: true}
#feature:name1 " hello world " // quote if contains whitespaces
helloworld // has {name1: " hello world "}
#wordlist Demo2-Feature-none
no-feature // has no features as all are cleared from the previous #wordlist

Giving these results: