Automated notion clustering for the knowledge LaTeX package
Project description
Knowledge-Clustering
Clustering notions for the knowledge LaTeX package. Maintained by Rémi Morvan, Thomas Colcombet and Aliaume Lopez.
Principle
The goal of Knowledge-Clustering is to help the user write a LaTeX document with the knowledge package. It has two features:
- Clustering: provide suggestions to the user of what notions should be grouped together.
- Add quotes: find where you might have missed some quotes in your document.
Installation
To install (or upgrade) Knowledge-Clustering, run
pip3 install --upgrade knowledge-clustering
and then
knowledge init
Clustering notions
Syntax
Usage: knowledge cluster [OPTIONS]
Edit a NOTION file using the knowledges present in a DIAGNOSE file.
Options:
-n, --notion FILE File containing the notions that are already
defined. [required]
-d, --diagnose FILE Diagnose file produced by LaTeX. [required]
-l, --lang [en|fr] Language of your TeX document.
-S, --scope / --no-scope Print the scopes defined in the notion file and
print the possible meaning of those scope inferred
by Knowledge Clustering.
-c, --config-file TEXT Specify the configuration file. By default the
configuration file in the folder
/Users/rmorvan/GDrive/Code/knowledge-
clustering/knowledge_clustering/data corresponding
to your language is used.
--help Show this message and exit.
Example
Example files can be found in the examples/
folder.
While writing some document, you have defined some knowledges in a file called small.tex
(distinct
from your main LaTeX
).
You continued writing your LaTeX
document (not provided in the examples/
folder)
for some time, and used some knowledges that were undefined.
When compiling, LaTeX
and the knowledge package
gives you a warning
and writes in a .diagnose
file some information explaining what went wrong. This .diagnose
file contains
a section called "Undefined knowledges" containing all knowledges used in your main LaTeX
file but not
defined in small.tex
. We reproduced this section
in the small.diagnose
file.
Normally, you would add every undefined knowledge, one after the other, in your
small.tex
. This is quite burdensome and can
largely be automated: you don't need a PhD to
understand that "word" and "words" are similar words. This is precisely what Knowledge-Clustering does: after running
knowledge cluster -n small.tex -d small.diagnose
your file small.diagnose
is left unchanged
but small.tex
is updated with comments.
The cluster
command is optional: you can also write knowledge -n small.tex -d small.diagnose
.
Now you simply have to check that the recommandations of Knowledge-Clustering are correct, and uncomment those lines.
Adding quotes
Usage: knowledge addquotes [OPTIONS]
Finds knowledges defined in NOTION that appear in TEX without quote symbols.
Proposes to add (or add, if the force option is enabled) quotes around them.
Options:
-t, --tex FILE Your TeX file. [required]
-n, --notion FILE File containing the notions that are already defined.
[required]
-F, --force Don't ask the user and always add quotes if a match is
found.
--help Show this message and exit.
Devel using virtualenv
Using virtualenv and the --editable
option from pip3
allows for an easy
setup of a development environment that will match a future user install without
the hassle.
For bash and Zsh users
virtualenv -p python3 kw-devel
source ./kw-devel/bin/activate
pip3 install --editable .
For fish users
virtualenv -p python3 kw-devel
source ./kw-devel/bin/activate.fish
pip3 install --editable .
FAQ
-
When running
knowledge
, I obtain a long message error indicating "Resource punkt not found."Solution: run
knowledge init
. -
My shell doesn't autocomplete the command
knowledge
.Solution: depending on whether you use
zsh
orbash
writeeval "`pip completion --<shellname>`"
(where
<shellname>
is eitherzsh
orbash
) in your.zshrc
(or.bashrc
) file and then, either lunch a new terminal or runsource ~/.zshrc
(orsource ~/.bashrc
).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for knowledge-clustering-0.3.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37536f1bd9741dfaca47b73ee413cb9ac97daf1af97ba1b5d2db01f969cff010 |
|
MD5 | 35d9ad963b9b2b3f539105a0c4367a45 |
|
BLAKE2b-256 | 56b7b59e365c81e921031f52a498357b710949eaa5334855c62e426ca7d8fac7 |
Hashes for knowledge_clustering-0.3.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a59fd1c411912596c0e4976bbca8bba9eb0be24f179b81f9aa4a8dfb01fe445 |
|
MD5 | c7ac04b0821371ec448c2d1ade4b07da |
|
BLAKE2b-256 | e789e7fab2c4b17d804ad94a43e549f34f7509ef88a69321b6554fc4fa127254 |