Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
user:zeman:interset:how-to-write-a-driver [2008/03/14 10:06] zeman %f was not defined here. |
user:zeman:interset:how-to-write-a-driver [2008/03/14 10:15] zeman Mutual positions of list() and BEGIN. |
||
---|---|---|---|
Line 35: | Line 35: | ||
The list is not necessary for the driver to work. However, it can be useful for [[#Test your driver|testing]] the driver. If no list is distributed along with the tagset description, | The list is not necessary for the driver to work. However, it can be useful for [[#Test your driver|testing]] the driver. If no list is distributed along with the tagset description, | ||
+ | |||
===== Alternative values ===== | ===== Alternative values ===== | ||
Line 65: | Line 66: | ||
Now, what do you do with features where you want to encode arrays? You should first check whether the value is an array or not. If it is an array, you may want to '' | Now, what do you do with features where you want to encode arrays? You should first check whether the value is an array or not. If it is an array, you may want to '' | ||
- | If the arrays | + | If the array turns out to be incompatible with what you expect, you should pick one value (we suggest you take the first one) and proceed with default single-value processing. |
<code perl> | <code perl> | ||
Line 94: | Line 95: | ||
**Note:** This approach cannot encode situations where some combinations of feature values are plausible and some are not! For instance, if positions [2] and [3] in a tag encode gender and number, respectively, | **Note:** This approach cannot encode situations where some combinations of feature values are plausible and some are not! For instance, if positions [2] and [3] in a tag encode gender and number, respectively, | ||
+ | |||
Line 108: | Line 110: | ||
Building the list of permitted values is expensive (all tags must be decoded!) and you should do it only once when your driver initializes. In your '' | Building the list of permitted values is expensive (all tags must be decoded!) and you should do it only once when your driver initializes. In your '' | ||
+ | |||
+ | (Note that the '' | ||
<code perl> | <code perl> | ||
use tagset:: | use tagset:: | ||
+ | ... | ||
+ | sub list { ... } | ||
+ | ... | ||
BEGIN | BEGIN | ||
{ | { |