update
This commit is contained in:
@@ -287,7 +287,11 @@ function textToDict(text::String, keywords::Vector{String};
|
||||
# use for loop and detect_keyword function to get the exact variation of each keyword in the text then push to kw list
|
||||
for keyword in keywords
|
||||
detected = detect_keyword(keyword, text)
|
||||
push!(kw, detected)
|
||||
if detected !== nothing
|
||||
push!(kw, detected)
|
||||
else
|
||||
error("Keyword $keyword not found in text.")
|
||||
end
|
||||
end
|
||||
|
||||
od1, od2 =
|
||||
@@ -793,7 +797,7 @@ Detects if a keyword exists in the text in different case variations (lowercase,
|
||||
"""
|
||||
function detect_keyword(keyword::String, text::String)::Union{Nothing, String}
|
||||
# Define the keyword variations to search for
|
||||
keyword_variations = [keyword, uppercasefirst(keyword), uppercase(keyword)]
|
||||
keyword_variations = [keyword, uppercasefirst(keyword), uppercase(keyword), lowercase(keyword)]
|
||||
|
||||
# Check if any of the keyword variations are in the text
|
||||
for variation in keyword_variations
|
||||
|
||||
Reference in New Issue
Block a user