Skip to content

Commit 37dee66

Browse files
committed
Ensure Attribute contract
1 parent 4ca88b5 commit 37dee66

23 files changed

Lines changed: 159 additions & 1861 deletions

analysis/src/java/com/github/oeuvres/alix/lucene/analysis/FilterCloud.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,8 @@
4040
import org.apache.lucene.analysis.tokenattributes.FlagsAttribute;
4141
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
4242

43-
import com.github.oeuvres.alix.common.Upos;
4443
import static com.github.oeuvres.alix.common.Upos.*;
4544

46-
import com.github.oeuvres.alix.lucene.analysis.tokenattributes.LemAtt;
47-
import com.github.oeuvres.alix.lucene.analysis.tokenattributes.OrthAtt;
4845
import com.github.oeuvres.alix.util.Char;
4946

5047
/**
@@ -62,10 +59,6 @@ public class FilterCloud extends TokenFilter
6259
private final PositionIncrementAttribute posIncrAtt = addAttribute(PositionIncrementAttribute.class);
6360
/** A linguistic category as a short number, see {@link TagFr} */
6461
private final FlagsAttribute flagsAtt = addAttribute(FlagsAttribute.class);
65-
/** A normalized orthographic form */
66-
private final OrthAtt orthAtt = addAttribute(OrthAtt.class);
67-
/** A lemma when possible */
68-
private final LemAtt lemAtt = addAttribute(LemAtt.class);
6962
/** keep right position order */
7063
private int holes;
7164

@@ -103,7 +96,7 @@ protected boolean skip()
10396
{
10497
final int flags = flagsAtt.getFlags();
10598
// known word from dictionary, keep it
106-
if (!lemAtt.isEmpty()) return false;
99+
// if (!lemAtt.isEmpty()) return false;
107100
// empty
108101
if (termAtt.isEmpty()) return true;
109102
// no position for XML between words M<sup>elle</sup>
@@ -131,9 +124,6 @@ protected boolean skip()
131124
protected boolean accept()
132125
{
133126
final int flags = flagsAtt.getFlags();
134-
if (flags == TEST.code) {
135-
System.out.println(termAtt + " — " + orthAtt);
136-
}
137127
// record an empty token at puctuation position for the rails
138128
if (PUNCT.isPunct(flags)) {
139129
if (flags == PUNCTclause.code) {
@@ -155,8 +145,8 @@ else if (flags == PUNCTpara.code || flags == PUNCTsection.code) {
155145
}
156146

157147
// do not keep flexion on substantives, no semantic gain
158-
if (!lemAtt.isEmpty()) termAtt.setEmpty().append(lemAtt);
159-
else if (!orthAtt.isEmpty()) termAtt.setEmpty().append(orthAtt);
148+
// if (!lemAtt.isEmpty()) termAtt.setEmpty().append(lemAtt);
149+
// else if (!orthAtt.isEmpty()) termAtt.setEmpty().append(orthAtt);
160150
// no more suffix
161151
return true;
162152
}

analysis/src/java/com/github/oeuvres/alix/lucene/analysis/FilterFind.java

Lines changed: 0 additions & 130 deletions
This file was deleted.

analysis/src/java/com/github/oeuvres/alix/lucene/analysis/FilterLocution.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@
4545
import com.github.oeuvres.alix.common.Upos;
4646

4747

48-
49-
import com.github.oeuvres.alix.lucene.analysis.tokenattributes.CharsAttImpl;
50-
import com.github.oeuvres.alix.lucene.analysis.tokenattributes.LemAtt;
51-
import com.github.oeuvres.alix.lucene.analysis.tokenattributes.OrthAtt;
5248
import com.github.oeuvres.alix.util.Chain;
5349

5450
/**
@@ -62,10 +58,6 @@ public class FilterLocution extends TokenFilter
6258
private final OffsetAttribute offsetAtt = addAttribute(OffsetAttribute.class);
6359
/** Current Flags */
6460
private final FlagsAttribute flagsAtt = addAttribute(FlagsAttribute.class);
65-
/** A normalized orthographic form (ex : capitalization) */
66-
private final OrthAtt orthAtt = addAttribute(OrthAtt.class);
67-
/** A lemma when possible */
68-
private final LemAtt lemAtt = addAttribute(LemAtt.class);
6961
/** A stack of states */
7062
private TokenStateQueue queue;
7163
/** A term used to concat a compound */

analysis/src/java/com/github/oeuvres/alix/lucene/analysis/FilterOrth.java

Lines changed: 0 additions & 147 deletions
This file was deleted.

0 commit comments

Comments
 (0)