diff --git a/.github/workflows/CompatHelpter.yml b/.github/workflows/CompatHelpter.yml index af6a2db..4a7ba26 100644 --- a/.github/workflows/CompatHelpter.yml +++ b/.github/workflows/CompatHelpter.yml @@ -3,14 +3,43 @@ on: schedule: - cron: 05 03 * * * workflow_dispatch: +permissions: + contents: write + pull-requests: write jobs: CompatHelper: runs-on: ubuntu-latest steps: - - name: Pkg.add("CompatHelper") - run: julia -e 'using Pkg; Pkg.add("CompatHelper")' - - name: CompatHelper.main() + - name: Check if Julia is already available in the PATH + id: julia_in_path + run: which julia + continue-on-error: true + - name: Install Julia, but only if it is not already available in the PATH + uses: julia-actions/setup-julia@v1 + with: + version: '1' + arch: ${{ runner.arch }} + if: steps.julia_in_path.outcome != 'success' + - name: "Add the General registry via Git" + run: | + import Pkg + ENV["JULIA_PKG_SERVER"] = "" + Pkg.Registry.add("General") + shell: julia --color=yes {0} + - name: "Install CompatHelper" + run: | + import Pkg + name = "CompatHelper" + uuid = "aa819f21-2bde-4658-8897-bab36330d9b7" + version = "3" + Pkg.add(; name, uuid, version) + shell: julia --color=yes {0} + - name: "Run CompatHelper" + run: | + import CompatHelper + CompatHelper.main() + shell: julia --color=yes {0} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} - run: julia -e 'using CompatHelper; CompatHelper.main()' + # COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }} diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml index eb6c861..b064ecf 100644 --- a/.github/workflows/TagBot.yml +++ b/.github/workflows/TagBot.yml @@ -8,7 +8,18 @@ on: lookback: default: 3 permissions: + actions: read + checks: read contents: write + deployments: read + issues: read + discussions: read + packages: read + pages: read + pull-requests: read + repository-projects: read + security-events: read + statuses: read jobs: TagBot: if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' @@ -17,3 +28,5 @@ jobs: - uses: JuliaRegistries/TagBot@v1 with: token: ${{ secrets.GITHUB_TOKEN }} + # Edit the following line to reflect the actual name of the GitHub Secret containing your private key + ssh: ${{ secrets.DOCUMENTER_KEY }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c698155..c96a3a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: version: - - '1.3' + - '1.6' - '1' - 'nightly' os: @@ -29,15 +29,15 @@ jobs: # MacOS not available on x86 - {os: 'macOS-latest', arch: 'x86'} # Don't test on all versions - - {os: 'macOS-latest', version: '1.3'} + - {os: 'macOS-latest', version: '1.6'} - {os: 'macOS-latest', version: 'nightly'} - - {os: 'windows-latest', version: '1.3'} + - {os: 'windows-latest', version: '1.6'} - {os: 'windows-latest', version: 'nightly'} - {os: 'windows-latest', arch: 'x86'} - - {arch: 'x86', version: '1.3'} + - {arch: 'x86', version: '1.6'} - {arch: 'x86', version: 'nightly'} steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@latest with: version: ${{ matrix.version }} @@ -50,10 +50,10 @@ jobs: name: Documentation runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@latest with: - version: '1.5' + version: '1.9' - run: julia --project=docs -e ' using Pkg; Pkg.develop(PackageSpec(; path=pwd())); diff --git a/.gitignore b/.gitignore index 57f4e53..ec1858a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store +.vscode /Manifest.toml /dev/ /docs/build/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e2be06b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -# Documentation: http://docs.travis-ci.com/user/languages/julia/ -language: julia -os: - - linux - - osx - - windows -julia: - - 1.3 - - 1.0 - - nightly -notifications: - email: false -matrix: - allow_failures: - - julia: nightly - exclude: - - os: osx - julia: 1.3 - - os: windows - julia: 1.3 - - os: osx - julia: nightly - - os: windows - julia: nightly - fast_finish: true diff --git a/Project.toml b/Project.toml index 81b7686..fd4db39 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Snowball" uuid = "fb8f903a-0164-4e73-9ffe-431110250c3b" authors = ["Avik Sengupta", "Julia Computing"] -version = "0.1.0" +version = "0.1.1" [deps] Languages = "8ef0a80b-9436-5d2c-a485-80b904378c43" @@ -10,6 +10,7 @@ WordTokenizers = "796a5d58-b03d-544a-977e-18100b691f6e" [compat] Languages = "0.4" +Snowball_jll = "2" WordTokenizers = "0.5" julia = "1.3" diff --git a/README.md b/README.md index 1755407..8c6848b 100644 --- a/README.md +++ b/README.md @@ -6,5 +6,4 @@ This code was extracted from the [TextAnalysis.jl](https://github.com/juliatext/ [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliahub.com/docs/Snowball) [![version](https://juliahub.com/docs/Snowball/version.svg)](https://juliahub.com/ui/Packages/Snowball/agUCL) -[![Build Status](https://travis-ci.org/juliatext/Snowball.jl.svg?branch=master)](https://travis-ci.com/juliatext/Snowball.jl) [![deps](https://juliahub.com/docs/Snowball/deps.svg)](https://juliahub.com/ui/Packages/Snowball/agUCL?t=2) diff --git a/docs/make.jl b/docs/make.jl index 081ec3f..3d2d636 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -6,10 +6,8 @@ makedocs(; pages=[ "Home" => "index.md", ], - repo="https://github.com/juliatext/Snowball.jl/blob/{commit}{path}#L{line}", sitename="Snowball.jl", authors="Avik Sengupta, Julia Computing", - assets=String[], ) deploydocs(; diff --git a/src/Snowball.jl b/src/Snowball.jl index 5e22cda..5a52e0f 100644 --- a/src/Snowball.jl +++ b/src/Snowball.jl @@ -78,13 +78,13 @@ end """ stem(stemmer::Stemmer, str) - stem(stemmer::Stemmer, words::Array) + stem(stemmer::Stemmer, words::Vector) Stem the input with the Stemming algorthm of `stemmer`. -See also: [`stem!`](@ref) +See also: [`stem_all`](@ref) """ -function stem(stemmer::Stemmer, bstr::AbstractString) +function stem(stemmer::Stemmer, bstr::AbstractString)::String sres = ccall((:sb_stemmer_stem, libstemmer), Ptr{UInt8}, (Ptr{UInt8}, Ptr{UInt8}, Cint), @@ -100,19 +100,13 @@ end tokenize the string with the default tokenizer, and then stem each word """ -function stem_all(stemmer::Stemmer, sentence) +function stem_all(stemmer::Stemmer, sentence::AbstractString)::String tokens = tokenize(sentence) stemmed = stem(stemmer, tokens) join(stemmed, ' ') end -function stem(stemmer::Stemmer, words::Array) - l::Int = length(words) - ret = Array{String}(undef, l) - for idx in 1:l - ret[idx] = stem(stemmer, words[idx]) - end - return ret -end +stem(stemmer::Stemmer, words::Vector{<:AbstractString})::Vector{String} = + map(w -> stem(stemmer, w), words) end # module