Datasets:
ArXiv:
License:
File size: 4,226 Bytes
c574d3a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package tool;
import tool.sieves.AffixationSieve;
import tool.sieves.CompoundPhraseSieve;
import tool.sieves.DiseaseModifierSynonymsSieve;
import tool.sieves.HyphenationSieve;
import tool.sieves.PartialMatchNCBISieve;
import tool.sieves.PartialMatchSieve;
import tool.sieves.PrepositionalTransformSieve;
import tool.sieves.Sieve;
import tool.sieves.SimpleNameSieve;
import tool.sieves.StemmingSieve;
import tool.sieves.SymbolReplacementSieve;
import tool.util.Concept;
import tool.util.Terminology;
/**
*
* @author
*/
public class PassAllSievesNormalizer {
public static int maxSieveLevel;
public static boolean pass(Concept concept, int currentSieveLevel) {
//System.out.println(concept.getCui());
if (!concept.getCui().equals("")) {
concept.setAlternateCuis(Sieve.getAlternateCuis(concept.getCui()));
concept.setNormalizingSieveLevel(currentSieveLevel-1);
System.out.println("Normalizing sieve is " + concept.getNormalizingSieve());
//Terminology.storeNormalizedConcept(concept);
return false;
}
if (currentSieveLevel > maxSieveLevel)
{
return false;
}
return true;
}
//behavior of this class
public static void applyPassAllSieves(Concept concept) {
int currentSieveLevel = 1;
// This is the sieve for exact match
//match with names in training data
//Sieve 1
concept.setCui(Sieve.exactMatchSieve(concept.getName()));
if (!pass(concept, ++currentSieveLevel))
return;
// This is the beginning of the second type of rules
//Sieve 2
concept.setCui(Sieve.exactMatchSieve(concept.getNameExpansion()));
if (!pass(concept, ++currentSieveLevel))
//Sieve 3
concept.setCui(PrepositionalTransformSieve.apply(concept));
System.out.println("Applied prepositional transforms");
if (!pass(concept, ++currentSieveLevel))
//Sieve 4
concept.setCui(SymbolReplacementSieve.apply(concept));
System.out.println("Applied Symbol replacement transforms");
if (!pass(concept, ++currentSieveLevel))
//Sieve 5
concept.setCui(HyphenationSieve.apply(concept));
System.out.println("Applied hyphenation transforms");
if (!pass(concept, ++currentSieveLevel))
//Sieve 6
concept.setCui(AffixationSieve.apply(concept));
System.out.println("Applied affixation transforms");
if (!pass(concept, ++currentSieveLevel))
//Sieve 7
concept.setCui(DiseaseModifierSynonymsSieve.apply(concept));
System.out.println("Applied disease modifier transforms");
if (!pass(concept, ++currentSieveLevel))
//Sieve 8
concept.setCui(StemmingSieve.apply(concept));
System.out.println("Applied stemming transforms");
if (!pass(concept, ++currentSieveLevel))
//Sieve 9
concept.setCui(Main.test_data_dir.toString().contains("ncbi") ? CompoundPhraseSieve.applyNCBI(concept.getName()) : CompoundPhraseSieve.apply(concept.getName()));
System.out.println(concept.getNamesKnowledgeBase());
if (!pass(concept, ++currentSieveLevel)) {
return;
}
//Sieve 10 - this is the sieve of the partial match
concept.setCui(SimpleNameSieve.apply(concept));
pass(concept, ++currentSieveLevel);
--currentSieveLevel;
if (!concept.getCui().equals(""))
return;
//Sieve 10
concept.setCui(Main.test_data_dir.toString().contains("ncbi") ? PartialMatchNCBISieve.apply(concept) : PartialMatchSieve.apply(concept));
pass(concept, ++currentSieveLevel);
System.out.println("xxxxxx Concept not normalized xxxxxxx");
}
}
|