-
Notifications
You must be signed in to change notification settings - Fork 2
Enhance slop detection and update sloplist.json #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
5a7ed0a
f5da852
e25be8e
8d76fea
c5475ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -63,6 +63,17 @@ export function detectPhraseLevel(text: string, items: string[]): SlopHit[] { | |||||||||||||||||||||||||
| return hits; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| export function detectEnding(text: string, items: string[]): SlopHit[] { | ||||||||||||||||||||||||||
| const tail = text.slice(-220).toLowerCase(); | ||||||||||||||||||||||||||
| const hits: SlopHit[] = []; | ||||||||||||||||||||||||||
|
Comment on lines
+67
to
+68
|
||||||||||||||||||||||||||
| for (const item of items) { | ||||||||||||||||||||||||||
| if (tail.includes(item.toLowerCase())) { | ||||||||||||||||||||||||||
|
Comment on lines
+67
to
+70
|
||||||||||||||||||||||||||
| const tail = text.slice(-220).toLowerCase(); | |
| const hits: SlopHit[] = []; | |
| for (const item of items) { | |
| if (tail.includes(item.toLowerCase())) { | |
| const normalizeEnding = (value: string): string => | |
| value.toLowerCase().replace(/[\s.!?,;:'")\]]+$/g, ""); | |
| const tail = normalizeEnding(text.slice(-220)); | |
| const hits: SlopHit[] = []; | |
| for (const item of items) { | |
| const normalizedItem = normalizeEnding(item); | |
| if (normalizedItem && tail.endsWith(normalizedItem)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ending_slop.itemscontains both "Feel free to ask if you have any more questions" and the shorter substring "Feel free to ask". With the current substring matching, the longer phrase will trigger both entries and double-count hits. Consider removing/rewriting the shorter entry for this category, or updating the detection logic to prefer the longest match / deduplicate overlaps.