You've already forked STARK
mirror of
https://github.com/MarkParker5/STARK.git
synced 2025-07-02 22:36:54 +02:00
Remove mp3 files, fuzzy recognition
This commit is contained in:
@ -15,6 +15,7 @@
|
||||
#
|
||||
|
||||
from abc import ABC, abstractmethod # for abstract class and methods
|
||||
from fuzzywuzzy import fuzz
|
||||
|
||||
class Command(ABC):
|
||||
_list = [] # list of all commands
|
||||
@ -88,13 +89,13 @@ class Command(ABC):
|
||||
chances[i] = 0
|
||||
for weight, words in obj.getKeywords().items():
|
||||
for word in words:
|
||||
if word in string:
|
||||
chances[i] += weight
|
||||
chances[i] += fuzz.partial_ratio(word, string) * weight
|
||||
print(chances)
|
||||
if( sum( chances.values() ) ):
|
||||
top = max( chances.values() ) / sum( chances.values() ) * 100
|
||||
else:
|
||||
return list[0]
|
||||
print(top)
|
||||
for i, chance in chances.items():
|
||||
if chance == max( chances.values() ):
|
||||
return list[i]
|
||||
|
Reference in New Issue
Block a user