Parts of Speech Tagger

In this section, we are going to use CAMeL Tools for Parts of Speech tagging. To start with, load the data as follows:

julia> using QuranTree

julia> crps, tnzl = load(QuranData());

julia> crpsdata = table(crps);

julia> tnzldata = table(tnzl);

For this task, we are going to use the second verse of Chapter 1.

julia> avrs1 = verses(tnzldata[1][2])[1]
"ٱلْحَمْدُ لِلَّهِ رَبِّ ٱلْعَٰلَمِينَ"

The will load the model:

julia> using Pkg

julia> Pkg.add("PyCall")
  Resolving package versions...
No Changes to `~/.julia/packages/QuranTree/JFGph/docs/Project.toml`
No Changes to `~/.julia/packages/QuranTree/JFGph/docs/Manifest.toml`

julia> using PyCall

julia> @pyimport camel_tools.disambig.mle as camel_disambig
ERROR: PyError (PyImport_ImportModule

The Python package camel_tools.disambig.mle could not be imported by pyimport. Usually this means
that you did not install camel_tools.disambig.mle in the Python version being used by PyCall.

PyCall is currently configured to use the Julia-specific Python distribution
installed by the Conda.jl package.  To install the camel_tools.disambig.mle module, you can
use `pyimport_conda("camel_tools.disambig.mle", PKG)`, where PKG is the Anaconda
package the contains the module camel_tools.disambig.mle, or alternatively you can use the
Conda package directly (via `using Conda` followed by `Conda.add` etcetera).

Alternatively, if you want to use a different Python distribution on your
system, such as a system-wide Python (as opposed to the Julia-specific Python),
you can re-configure PyCall with that Python.   As explained in the PyCall
documentation, set ENV["PYTHON"] to the path/name of the python executable
you want to use, run Pkg.build("PyCall"), and re-launch Julia.

) <class 'ModuleNotFoundError'>
ModuleNotFoundError("No module named 'camel_tools'")

julia> @pyimport camel_tools.tagger.default as camel_tagger
ERROR: PyError (PyImport_ImportModule

The Python package camel_tools.tagger.default could not be imported by pyimport. Usually this means
that you did not install camel_tools.tagger.default in the Python version being used by PyCall.

PyCall is currently configured to use the Julia-specific Python distribution
installed by the Conda.jl package.  To install the camel_tools.tagger.default module, you can
use `pyimport_conda("camel_tools.tagger.default", PKG)`, where PKG is the Anaconda
package the contains the module camel_tools.tagger.default, or alternatively you can use the
Conda package directly (via `using Conda` followed by `Conda.add` etcetera).

Alternatively, if you want to use a different Python distribution on your
system, such as a system-wide Python (as opposed to the Julia-specific Python),
you can re-configure PyCall with that Python.   As explained in the PyCall
documentation, set ENV["PYTHON"] to the path/name of the python executable
you want to use, run Pkg.build("PyCall"), and re-launch Julia.

) <class 'ModuleNotFoundError'>
ModuleNotFoundError("No module named 'camel_tools'")

julia> mled = camel_disambig.MLEDisambiguator.pretrained()
ERROR: UndefVarError: camel_disambig not defined

Tagging

From the model, we instantiate the DefaultTagger and finally call the tag method to tag the token:

julia> tagger = camel_tagger.DefaultTagger(mled, "pos")
ERROR: UndefVarError: camel_tagger not defined

julia> tagger.tag(split(avrs1))
ERROR: UndefVarError: tagger not defined