Skip to content

Commit

Permalink
removes explicit textconfig as arg
Browse files Browse the repository at this point in the history
  • Loading branch information
sadit committed Mar 30, 2023
1 parent d581f8d commit b93aa89
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "TextSearch"
uuid = "7f6f6c8a-3b03-11e9-223d-e7d88259bd6c"
authors = ["Eric S. Tellez <donsadit@gmail.com>"]
version = "0.16.2"
version = "0.16.1"

[deps]
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
Expand Down
14 changes: 7 additions & 7 deletions src/voc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ Computes a vocabulary from a corpus using the TextConfig `textconfig`.
"""
function Vocabulary(textconfig::TextConfig, corpus::AbstractVector; minbatch=0)
voc = Vocabulary(textconfig, length(corpus))
tokenize_and_append!(voc, textconfig, corpus; minbatch)
tokenize_and_append!(voc, corpus; minbatch)
voc
end

function locked_tokenize_and_push(voc, textconfig, doc, buff, l)
function locked_tokenize_and_push(voc, doc, buff, l)
empty!(buff)

for token in tokenize(borrowtokenizedtext, textconfig, doc, buff)
for token in tokenize(borrowtokenizedtext, voc.textconfig, doc, buff)
id = 0
lock(l)
try
Expand All @@ -90,11 +90,11 @@ function locked_tokenize_and_push(voc, textconfig, doc, buff, l)
end

"""
tokenize_and_append!(voc::Vocabulary, textconfig::TextConfig, corpus; minbatch=0)
tokenize_and_append!(voc::Vocabulary, corpus; minbatch=0)
Parse each document in the given corpus and appends each token to the vocabulary.
"""
function tokenize_and_append!(voc::Vocabulary, textconfig::TextConfig, corpus; minbatch=0)
function tokenize_and_append!(voc::Vocabulary, corpus; minbatch=0)
l = Threads.SpinLock()
n = length(corpus)
minbatch = getminbatch(minbatch, n)
Expand All @@ -108,10 +108,10 @@ function tokenize_and_append!(voc::Vocabulary, textconfig::TextConfig, corpus; m
try
if doc isa AbstractVector
for text in doc
locked_tokenize_and_push(voc, textconfig, text, buff, l)
locked_tokenize_and_push(voc, text, buff, l)
end
else # if doc isa AbstractString
locked_tokenize_and_push(voc, textconfig, doc, buff, l)
locked_tokenize_and_push(voc, doc, buff, l)
end
finally
put!(TEXT_SEARCH_CACHES, buff)
Expand Down

2 comments on commit b93aa89

@sadit
Copy link
Owner Author

@sadit sadit commented on b93aa89 Mar 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/80682

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.16.1 -m "<description of version>" b93aa898e937ca8dc2a6527a9bb63dd98fe96da6
git push origin v0.16.1

Please sign in to comment.