private String checkSegments ( String key , Set < String > corpora , CorpusConfigMap corpusConfigurations ) { String segmentation = null ; for ( String corpus : corpora ) { CorpusConfig c = null ; if ( corpusConfigurations . containsConfig ( corpus ) ) { c = corpusConfigurations . get ( corpus ) ; } else { c = corpusConfigurations . get ( DEFAULT_CONFIG ) ; } // do nothing if not even default config is set if ( c == null ) { continue ; } String tmpSegment = c . getConfig ( key ) ; /** * If no segment is set in the corpus config use always the tok segment. */ if ( tmpSegment == null ) { return corpusConfigurations . get ( DEFAULT_CONFIG ) . getConfig ( key ) ; } if ( segmentation == null ) { segmentation = tmpSegment ; continue ; } if ( ! segmentation . equals ( tmpSegment ) ) // return the default config { return corpusConfigurations . get ( DEFAULT_CONFIG ) . getConfig ( key ) ; } } if ( segmentation == null ) { return corpusConfigurations . get ( DEFAULT_CONFIG ) . getConfig ( key ) ; } else { return segmentation ; } }
Checks if all selected corpora have the same default segmentation layer . If not the tok layer is taken because every corpus has this one .