Esempio n. 1
0
 internal ExtractorWordShapeClassifier(int position, string wsc)
     : base(position, false)
 {
     // end class ExtractorFrames
     // This cache speeds things up a little bit.  I used
     // -Xrunhprof:cpu=samples,interval=1 when using the "distsim" tagger
     // on the training set to measure roughly how much time was spent in
     // this method.  I concluded that with the cache, 1.24% of the time
     // is spent here, and without the cache, 1.26% of the time is spent
     // here.  This is a very small savings, which would be even smaller
     // if we make the cache thread safe.  It turns out that, as written,
     // the cache is not thread safe for various reasons.  In particular,
     // it assumes only one wordshape classifier is ever used, which
     // might not be true even with just one tagger, and has an even
     // higher chance of not being true if there are multiple taggers.
     // Furthermore, access to the cache should really be synchronized
     // regardless.  The easiest solution is to comment out the cache and
     // note that if you want to bring it back, make it a map from wsc to
     // cache rather than just a single cache.  -- horatio
     //private static final Map<String, String> shapes =
     //  Generics.newHashMap();
     // --- should be:
     //private static final Map<String, Map<String, String>> ...
     wordShaper = WordShapeClassifier.LookupShaper(wsc);
     name       = "ExtractorWordShapeClassifier(" + position + ',' + wsc + ')';
 }
Esempio n. 2
0
 internal ExtractorWordShapeConjunction(int left, int right, string wsc)
     : base()
 {
     this.left  = left;
     this.right = right;
     wordShaper = WordShapeClassifier.LookupShaper(wsc);
     name       = "ExtractorWordShapeConjunction(" + left + ',' + right + ',' + wsc + ')';
 }