Skip to content

Commit

Permalink
fix: improve extraction rules
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jul 28, 2021
1 parent 67251a8 commit 5850694
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/extraction/rules/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@ export class BasicExtrationRule extends ExtractionRule {
// ❌ camel case
if (s.match(/[a-z][A-Z0-9]/))
return ExtractionScore.ShouldExclude
// ❌ all small cases
// ❌ all lower cases
if (s.match(/^[a-z0-9-]+$/))
return ExtractionScore.ShouldExclude
// ❌ all upper cases
if (s.match(/^[A-Z0-9-]+$/))
return ExtractionScore.ShouldExclude
// ❌ all digits
if (s.match(/^[\d.]+$/))
return ExtractionScore.ShouldExclude
// βœ… all words
if (s.match(/^[A-Za-z0-9]+$/))
return ExtractionScore.ShouldInclude
// βœ… one char
if (s.length === 1 && !'/.-\\:+$^#,'.includes(s))
if (s.length === 1 && !'/.-\\:+$^#_"\','.includes(s))
return ExtractionScore.ShouldInclude
}
}

0 comments on commit 5850694

Please sign in to comment.