mosesdecoder/vw/README.md

74 lines
2.3 KiB
Markdown
Raw Normal View History

2015-01-09 17:01:38 +03:00
Vowpal Wabbit for Moses
=======================
This is an attempt to integrate Vowpal Wabbit with Moses as a stateless feature
function.
Implemented classifier features
-------------------------------
2015-01-09 17:13:59 +03:00
* VWFeatureSourceBagOfWords: This creates a feature of form bow^token for every
2015-01-09 17:05:39 +03:00
source sentence token.
2015-01-09 17:16:51 +03:00
* VWFeatureSourceExternalFeatures column=0: (not quite finished yet) when used with -inputtype 5 this can be used to supply additional feature to VW. The input is a tab-separated file, the first column is the usual input sentence, all other columns can be used for meta-data. Parameter column=0 counts beginning with the first column that is not the input sentence.
2015-01-09 17:13:59 +03:00
* VWFeatureSourceIndicator: Ass a feature for the whole source phrase.
* VWFeatureSourcePhraseInternal: Adds a separate feature for every word of the source phrase.
2015-01-09 17:16:51 +03:00
* VWFeatureSourceWindow size=3: Adds source words in a window of size 3 before and after the source phrase as features. These does not overlap with VWFeatureSourcePhraseInternal.
2015-01-09 17:13:59 +03:00
* VWFeatureTargetIndicator: Adds a feature for the whole target phrase.
* VWFeatureTargetPhraseInternal: Adds a separate feature for every word of the target phrase.
2015-01-09 17:01:38 +03:00
Configuration
-------------
To use the classifier edit your moses.ini
2015-01-09 17:04:10 +03:00
[features]
...
VW path=/home/username/vw/classifier1.vw
VWFeatureSourceBagOfWords
VWFeatureTargetIndicator
2015-01-09 17:05:39 +03:00
VWFeatureSourceIndicator
2015-01-09 17:04:10 +03:00
...
[weights]
...
VW0= 0.2
...
2015-01-09 17:01:38 +03:00
If you change the name of the main VW feature, remember to tell the VW classifier
features which classifier they belong to:
2015-01-09 17:04:10 +03:00
[features]
...
VW name=bart path=/home/username/vw/classifier1.vw
VWFeatureSourceBagOfWords used-by=bart
VWFeatureTargetIndicator used-by=bart
2015-01-09 17:05:39 +03:00
VWFeatureSourceIndicator used-by=bart
2015-01-09 17:04:10 +03:00
...
[weights]
...
bart= 0.2
...
2015-01-09 17:01:38 +03:00
You can also use multiple classifiers:
2015-01-09 17:04:10 +03:00
[features]
...
VW name=bart path=/home/username/vw/classifier1.vw
VW path=/home/username/vw/classifier2.vw
VW path=/home/username/vw/classifier3.vw
VWFeatureSourceBagOfWords used-by=bart,VW0
VWFeatureTargetIndicator used-by=VW1,VW0,bart
VWFeatureSourceIndicator used-by=bart,VW1
...
[weights]
...
bart= 0.2
VW0= 0.2
VW1= 0.2
...
2015-01-09 17:01:38 +03:00
Training the classifier
2015-01-09 17:13:59 +03:00
-----------------------