Ignore:
Timestamp:
2017-03-13T15:30:13+13:00 (7 years ago)
Author:
davidb
Message:

Monitor for missing POS keys, and print out details first time each missing type is encountered

File:
1 edited

Legend:

Unmodified
Added
Removed
  • other-projects/hathitrust/wcsa/extracted-features-solr/trunk/solr-ingest/src/main/java/org/hathitrust/extractedfeatures/UniversalPOSLangMap.java

    r31498 r31503  
    1616
    1717    protected HashMap<String,HashMap<String,String>> _all_langmaps;
     18   
     19    protected HashMap<String,Integer> _missing_pos;
    1820   
    1921    public UniversalPOSLangMap(String langmap_directory) {
     
    8688        if (langmap != null) {
    8789            universal_pos = langmap.get(opennlp_pos_key);
     90            if (universal_pos == null) {
     91                String missing_lang_pos = lang_key + ":" + opennlp_pos_key;
     92               
     93                Integer mpos_freq = 0;
     94                if (_missing_pos.containsKey(missing_lang_pos)) {
     95                    mpos_freq = _missing_pos.get(missing_lang_pos);
     96                }
     97                else {
     98                    System.err.println("Warning: for language key '"+lang_key
     99                            +"' failed to find POS '" + opennlp_pos_key + "'");
     100                    System.err.println("Defaulting to POS 'X' (i.e., 'other')");
     101                }
     102                mpos_freq++;
     103                _missing_pos.put(lang_key,mpos_freq);
     104               
     105                universal_pos = "X";
     106            }
    88107        }
    89108       
Note: See TracChangeset for help on using the changeset viewer.