|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface NameConverter
The interface of a converter from names to structures.
| Method Summary | |
|---|---|
Molecule |
convert(java.lang.String name)
Convert a name into the corresponding structure. |
boolean |
setPrefixMode(boolean prefixMode)
Set the prefix mode flag. |
| Method Detail |
|---|
Molecule convert(java.lang.String name)
throws NameFormatException
null,
or by throwing a NameFormatException.
name - the chemical name to be converted
null if the name is not recognized.
NameFormatException - when the name does not correspond to a structure
NamePrefixException - when the name does not correspond to a structure, but is a possible prefix
of a valid name.boolean setPrefixMode(boolean prefixMode)
When converting a document, it is not directly possible to know where name start and end. For instance, suppose that a converter knows the structure for "Prussian Blue" by looking it up in a database. Given the sentence "The Prussian Blue chemical was used to color textiles in blue", the word "Prussian" alone would be passed to the converter. If prefix mode has been successfully activated, the converter should throw a NamePrefixException, indicating that it knows a name starting with this prefix.
The prefix mode is an optional optimization. If a converter does not support it, it can return false to this call. In this case, the system will always try to call again after concatenating several words (up to a limit or a detected end of sentence). This ensures that names containing spaces will be recognized, at the cost of more conversion attempts.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||