Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"publisher": "SiddharthaPrasad",
"icon": "images/icon.png",
"license": "MIT",
"version": "0.5.4",
"version": "0.5.5",
"repository": {
"type": "git",
"url": "https://github.com/sidprasad/pick-regex"
Expand Down
11 changes: 3 additions & 8 deletions src/pickController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -682,15 +682,12 @@ export class PickController {
for (const record of this.wordHistory) {
if (record.classification === WordClassification.ACCEPT) {
for (const candidate of this.candidates) {
if (candidate.eliminated) {
continue;
}
if (this.analyzer.verifyMatch(record.word, candidate.pattern)) {
candidate.positiveVotes++;
} else {
// Candidate fails to match an accepted word - negative vote
candidate.negativeVotes++;
if (candidate.negativeVotes >= candidate.eliminationThreshold) {
if (!candidate.eliminated && candidate.negativeVotes >= candidate.eliminationThreshold) {
candidate.eliminated = true;
logger.info(
`[Replay] Eliminated candidate "${candidate.pattern}" after ${candidate.negativeVotes} negative votes (threshold ${candidate.eliminationThreshold}) - failed to match accepted word "${record.word}".`
Expand All @@ -700,18 +697,16 @@ export class PickController {
}
} else if (record.classification === WordClassification.REJECT) {
for (const candidate of this.candidates) {
if (candidate.eliminated) {
continue;
}
if (this.analyzer.verifyMatch(record.word, candidate.pattern)) {
candidate.negativeVotes++;
if (candidate.negativeVotes >= candidate.eliminationThreshold) {
if (!candidate.eliminated && candidate.negativeVotes >= candidate.eliminationThreshold) {
candidate.eliminated = true;
logger.info(
`[Replay] Eliminated candidate "${candidate.pattern}" after ${candidate.negativeVotes} negative votes (threshold ${candidate.eliminationThreshold}) - incorrectly matched rejected word "${record.word}".`
);
}
}
// If doesn't match: no vote (correctly rejecting is neutral/expected)
}
}
}
Expand Down