Hi,

Am 25.04.2013 03:29, schrieb William Karl Thompson:
Hello,

(My apologies, I mistakenly sent this to the dev list initially)

I'm very interested in using the TextMarker project, but the current set of 
action types doesn't quite do what I need. I found references to an extension 
mechanism, have also found the ITextMarkerActionExtension interface in the 
source code. I also found the antlr grammar and lexer files where the 
TextMarker language is defined, which appears to be where new action type names 
are to be added. So I surmise the steps to add new actions is to


1.       Add the desired action signature to the antlr grammar

2.       Define an implementation of ITextMarkerActionExtension that implements 
the functionality.

Is there an easier way to do this? My concern is that I need to modify 
TextMarker source files (the grammar and lexer files), which would be 
overwritten on any updated version of TextMarker.

This should be possible without changing any textmarker code.

There is a generic parsing rule in the grammar, which creates an external action using the set of ITextMarkerExtension mentioned in the descriptor (parameter: additionalExtensions). There is no default syntax check since the possible arguments are of course not yet known by the engine. Syntax checks need to be implemented in the ITextMarkerActionExtension.createAction(), which throws an ANTLRException. The arguments of the action are delegated to this method, which return the action implementation, so there will probably many casts and "if instanceOf" checks. Language constructs like assignments ("feature" = Type) known by the CREATE action, are not yet supported.

Unfortunately, there is no automatic integration in the workbench yet. You have to modify the BasicEngine (add the extension) in the textmarker project yourself. The implemenatation of the extension needs of course then also be available to the workbench.

I haven't used the language extensions since 2009 (it was a wordnet integration) and they are not yet covered by unit tests. So, there are maybe some bugs due to the changes after the contribution to Apache UIMA. However, I will check the functionality, add a test case and extend the documentation.

Concerning the list of available actions: You are of course also welcome to create feature requests for new actions. The current set of actions is mainly based on my own requirements and I will gladly add new reasonable/generic actions (within the limits of my available time).

Best,

Peter

Thanks!

Will Thompson


Reply via email to