kitconc 4.0.0__tar.gz → 4.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. {kitconc-4.0.0 → kitconc-4.0.2}/CHANGES.txt +18 -0
  2. {kitconc-4.0.0 → kitconc-4.0.2}/MANIFEST.in +1 -2
  3. {kitconc-4.0.0/kitconc.egg-info → kitconc-4.0.2}/PKG-INFO +14 -2
  4. {kitconc-4.0.0 → kitconc-4.0.2}/README.txt +13 -1
  5. kitconc-4.0.2/howto/01_howto_create-new-corpus.py +5 -0
  6. kitconc-4.0.2/howto/02_howto_create-wordlist.py +9 -0
  7. kitconc-4.0.2/howto/03_howto_extract-keywords.py +5 -0
  8. kitconc-4.0.2/howto/04_howto_create-kwic.py +6 -0
  9. kitconc-4.0.2/howto/05_howto_create-concordances.py +5 -0
  10. kitconc-4.0.2/howto/06_howto_find-collocates.py +5 -0
  11. kitconc-4.0.2/howto/07_howto_make-clusters.py +5 -0
  12. kitconc-4.0.2/howto/08_howto_make-ngrams.py +5 -0
  13. kitconc-4.0.2/howto/09_howto_create-dispersion-plots.py +5 -0
  14. kitconc-4.0.2/howto/10_howto_find-collocates.py +8 -0
  15. kitconc-4.0.2/howto/11_howto_plot-collgraph-collocates.py +7 -0
  16. kitconc-4.0.2/howto/12_howto_access-corpus-words.py +10 -0
  17. kitconc-4.0.2/howto/13_howto_acess-corpus-sentences.py +9 -0
  18. kitconc-4.0.2/howto/14_howto_create-corpus_with_spaCy.py +11 -0
  19. kitconc-4.0.2/howto/15_howto_load-a-tagged-corpus.py +27 -0
  20. kitconc-4.0.2/howto/16_howto_train-a-pos-model.py +36 -0
  21. kitconc-4.0.2/howto/17_howto_export-a-corpus.py +3 -0
  22. kitconc-4.0.2/howto/18_howto_import-a-corpus.py +4 -0
  23. kitconc-4.0.2/howto/19_howto_compare-keywords.py +12 -0
  24. kitconc-4.0.2/howto/20_howto_advanced-kwic.py +12 -0
  25. kitconc-4.0.2/howto/21_howto_measure-dispersion.py +12 -0
  26. kitconc-4.0.2/howto/22_howto_make-pframes-and-lemmas.py +13 -0
  27. kitconc-4.0.2/howto/23_howto_make-wordcloud-and-fileview.py +10 -0
  28. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/corpus_tools.py +3 -2
  29. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/guides/recipes.md +22 -0
  30. kitconc-4.0.2/kitconc/agent/skill/kitconc-recipe-author/SKILL.md +60 -0
  31. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/skill_installer.py +21 -17
  32. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/kit_corpus.py +20 -2
  33. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/py_wordlist.py +3 -1
  34. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/version.py +1 -1
  35. {kitconc-4.0.0 → kitconc-4.0.2/kitconc.egg-info}/PKG-INFO +14 -2
  36. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc.egg-info/SOURCES.txt +24 -0
  37. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc.egg-info/top_level.txt +1 -0
  38. {kitconc-4.0.0 → kitconc-4.0.2}/pyproject.toml +2 -2
  39. {kitconc-4.0.0 → kitconc-4.0.2}/tests/test_agent_mcp_server.py +37 -0
  40. {kitconc-4.0.0 → kitconc-4.0.2}/tests/test_corpus_ingestion.py +34 -1
  41. {kitconc-4.0.0 → kitconc-4.0.2}/tests/test_legacy_reliability.py +16 -0
  42. {kitconc-4.0.0 → kitconc-4.0.2}/LICENSE.txt +0 -0
  43. {kitconc-4.0.0 → kitconc-4.0.2}/embeddings/__init__.py +0 -0
  44. {kitconc-4.0.0 → kitconc-4.0.2}/embeddings/chunker.py +0 -0
  45. {kitconc-4.0.0 → kitconc-4.0.2}/embeddings/sqlite_vec_search.py +0 -0
  46. {kitconc-4.0.0 → kitconc-4.0.2}/embeddings/util.py +0 -0
  47. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/__init__.py +0 -0
  48. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/__init__.py +0 -0
  49. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/actions.py +0 -0
  50. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/expressions.py +0 -0
  51. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/guides/expressions.md +0 -0
  52. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/guides/measures.md +0 -0
  53. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/guides/overview.md +0 -0
  54. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/guides/pipelines.md +0 -0
  55. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/guides/terminology.md +0 -0
  56. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/jobs.py +0 -0
  57. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/mcp_server.py +0 -0
  58. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/pipeline.py +0 -0
  59. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/progress.py +0 -0
  60. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/recipes/collocation-entry.json +0 -0
  61. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/recipes/compare-corpora.json +0 -0
  62. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/recipes/corpus-profile.json +0 -0
  63. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/recipes/corpus-qa.json +0 -0
  64. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/recipes/glossary-candidates.json +0 -0
  65. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/recipes/glossary-contrastive.json +0 -0
  66. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/recipes/keyword-report.json +0 -0
  67. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/recipes/lexical-bundles.json +0 -0
  68. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/recipes/synonym-comparison.json +0 -0
  69. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/recipes/word-frequency-comparison.json +0 -0
  70. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/recipes/word-profile.json +0 -0
  71. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/recipes.py +0 -0
  72. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/resources.py +0 -0
  73. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/result_ops.py +0 -0
  74. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/results.py +0 -0
  75. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/schemas.py +0 -0
  76. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/skill/kitconc/SKILL.md +0 -0
  77. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/skill/kitconc/references/expressions.md +0 -0
  78. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/skill/kitconc/references/pipelines.md +0 -0
  79. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/skill/kitconc/references/python-api.md +0 -0
  80. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/tagsets.py +0 -0
  81. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/tool_cli.py +0 -0
  82. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/agent/tools.py +0 -0
  83. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/archive.py +0 -0
  84. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/cli_app.py +0 -0
  85. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/core.py +0 -0
  86. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/data/gui_lang.pickle +0 -0
  87. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/data/gui_lang_default.pickle +0 -0
  88. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/data/images/excel.png +0 -0
  89. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/data/images/python.png +0 -0
  90. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/data/images/python3.ico +0 -0
  91. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/data/images/python3_b.ico +0 -0
  92. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/data/images/python_b.png +0 -0
  93. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/data/images/script.png +0 -0
  94. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/data/images/text.png +0 -0
  95. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/data/images/tool.png +0 -0
  96. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/data/lemmas_english.tab +0 -0
  97. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/data/pos_tagger_english.pickle +0 -0
  98. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/data/pos_tagger_portuguese.pickle +0 -0
  99. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/data/reflist_english.tab +0 -0
  100. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/data/reflist_no-tagging.tab +0 -0
  101. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/data/reflist_portuguese.tab +0 -0
  102. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/data/scripts/hello.py +0 -0
  103. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/data/sent_tokenizer_english.pickle +0 -0
  104. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/data/sent_tokenizer_portuguese.pickle +0 -0
  105. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/data/stoplist_english.tab +0 -0
  106. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/data/stoplist_no-tagging.tab +0 -0
  107. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/data/stoplist_portuguese.tab +0 -0
  108. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/data/ubuntu.ttf +0 -0
  109. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/data/word_tokenizer_english.pickle +0 -0
  110. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/data/word_tokenizer_portuguese.pickle +0 -0
  111. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/export_corpus.py +0 -0
  112. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/indexing.py +0 -0
  113. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/kit_app.py +0 -0
  114. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/kit_app_language.py +0 -0
  115. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/kit_cmd.py +0 -0
  116. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/kit_data.py +0 -0
  117. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/kit_models.py +0 -0
  118. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/kit_plots.py +0 -0
  119. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/kit_spacy.py +0 -0
  120. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/kit_tools.py +0 -0
  121. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/kit_util.py +0 -0
  122. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/nlp.py +0 -0
  123. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/npyarrays.py +0 -0
  124. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/py_clusters.py +0 -0
  125. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/py_collocates.py +0 -0
  126. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/py_concordance.py +0 -0
  127. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/py_dispersion.py +0 -0
  128. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/py_extras.py +0 -0
  129. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/py_keywords.py +0 -0
  130. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/py_keywords_dispersion.py +0 -0
  131. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/py_kwic.py +0 -0
  132. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/py_measures.py +0 -0
  133. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/py_ngrams.py +0 -0
  134. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/py_wfreqinfiles.py +0 -0
  135. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/py_wtfreq.py +0 -0
  136. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/tagged.py +0 -0
  137. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc/tagging.py +0 -0
  138. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc.egg-info/dependency_links.txt +0 -0
  139. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc.egg-info/entry_points.txt +0 -0
  140. {kitconc-4.0.0 → kitconc-4.0.2}/kitconc.egg-info/requires.txt +0 -0
  141. {kitconc-4.0.0 → kitconc-4.0.2}/setup.cfg +0 -0
  142. {kitconc-4.0.0 → kitconc-4.0.2}/tests/test_agent_cli_and_skill.py +0 -0
  143. {kitconc-4.0.0 → kitconc-4.0.2}/tests/test_agent_workflows.py +0 -0
  144. {kitconc-4.0.0 → kitconc-4.0.2}/tests/test_analysis_features.py +0 -0
  145. {kitconc-4.0.0 → kitconc-4.0.2}/tests/test_nlp.py +0 -0
  146. {kitconc-4.0.0 → kitconc-4.0.2}/tests/test_py_keywords.py +0 -0
  147. {kitconc-4.0.0 → kitconc-4.0.2}/tests/test_py_ngrams.py +0 -0
  148. {kitconc-4.0.0 → kitconc-4.0.2}/tests/test_py_wordlist.py +0 -0
@@ -1,3 +1,21 @@
1
+ Version 4.0.2
2
+ -------------
3
+ - 2026-10-31
4
+ - Fixed corpus creation and subcorpus creation hanging under MCP stdio on Windows by isolating
5
+ subprocess stdin and explicitly closing inherited handles. Indexing stages now have a timeout.
6
+ - Persist corpus size statistics at ingestion time and refresh wordlist caches after reindexing.
7
+ Empty token arrays produce zero statistics. Recreate temporary folders when adding texts again.
8
+ - Clarified that corpus QA detects non-text content by token ratios, not file extensions.
9
+ - Aligned the application-reported version with the package version.
10
+
11
+ Version 4.0.1
12
+ -------------
13
+ - 2026-10-11
14
+ - Added the `kitconc-recipe-author` Agent Skill to guide users through designing, validating,
15
+ running, and saving custom recipes. `kitconc-skill install` now installs it alongside the
16
+ general Kitconc skill for Claude and Codex.
17
+ - Expanded recipe authoring documentation and included the new skill in source and wheel packages.
18
+
1
19
  Version 4.0.0
2
20
  -------------
3
21
  - 2026-10-11
@@ -7,5 +7,4 @@ include kitconc/data/images/*.ico
7
7
  include kitconc/data/scripts/*.py
8
8
  include kitconc/agent/guides/*.md
9
9
  include kitconc/agent/recipes/*.json
10
- include kitconc/agent/skill/kitconc/*.md
11
- include kitconc/agent/skill/kitconc/references/*.md
10
+ recursive-include kitconc/agent/skill *.md
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kitconc
3
- Version: 4.0.0
3
+ Version: 4.0.2
4
4
  Summary: A toolkit for Corpus Linguistics Analysis
5
5
  Author-email: José Lopes Moreira Filho <jlopes@alumni.usp.br>
6
6
  License-Expression: MIT
@@ -28,7 +28,7 @@ Requires-Dist: uvicorn[standard]<1.0.0,>=0.27; extra == "full"
28
28
  Requires-Dist: python-dotenv<2.0.0,>=1.0.0; extra == "full"
29
29
  Dynamic: license-file
30
30
 
31
- Kitconc 3.5.0
31
+ Kitconc 4.0.2
32
32
  =============
33
33
 
34
34
  Kitconc is a package for Corpus Linguistics and text analysis with Python.
@@ -166,6 +166,18 @@ sheet_name="Wordlist".
166
166
  MCP runtime is included in package dependencies
167
167
  (uv sync is enough).
168
168
 
169
+ Agent skills for Claude and Codex
170
+ =================================
171
+
172
+ Install the bundled Kitconc skills without a global pip installation (requires uv):
173
+
174
+ uvx --from kitconc kitconc-skill install
175
+
176
+ This installs the general corpus-analysis skill and the kitconc-recipe-author skill. The latter
177
+ guides an assistant to design a reusable recipe from a user's goal, validate the pipeline, run it
178
+ when useful, and save it to the active Kitconc workspace. To update an existing installation, add
179
+ --force. See the GitHub README for examples and the complete recipe-authoring guide.
180
+
169
181
  What's new in 3.2.0
170
182
  ====================
171
183
 
@@ -1,4 +1,4 @@
1
- Kitconc 3.5.0
1
+ Kitconc 4.0.2
2
2
  =============
3
3
 
4
4
  Kitconc is a package for Corpus Linguistics and text analysis with Python.
@@ -136,6 +136,18 @@ sheet_name="Wordlist".
136
136
  MCP runtime is included in package dependencies
137
137
  (uv sync is enough).
138
138
 
139
+ Agent skills for Claude and Codex
140
+ =================================
141
+
142
+ Install the bundled Kitconc skills without a global pip installation (requires uv):
143
+
144
+ uvx --from kitconc kitconc-skill install
145
+
146
+ This installs the general corpus-analysis skill and the kitconc-recipe-author skill. The latter
147
+ guides an assistant to design a reusable recipe from a user's goal, validate the pipeline, run it
148
+ when useful, and save it to the active Kitconc workspace. To update an existing installation, add
149
+ --force. See the GitHub README for examples and the complete recipe-authoring guide.
150
+
139
151
  What's new in 3.2.0
140
152
  ====================
141
153
 
@@ -0,0 +1,5 @@
1
+ from kitconc.kit_corpus import Corpus
2
+ # reference to the corpus
3
+ corpus = Corpus('kitconc_workspace','ads','english')
4
+ # add texts from source folder
5
+ corpus.add_texts('kitconc_corpora/ads',verbose=True)
@@ -0,0 +1,9 @@
1
+ from kitconc.kit_corpus import Corpus
2
+ # reference to the corpus
3
+ corpus = Corpus('kitconc_workspace','ads','english')
4
+ # make wordlist
5
+ wordlist = corpus.wordlist(verbose=True)
6
+ # print the top 10
7
+ print(wordlist.df.head(10))
8
+ # save Excel file
9
+ wordlist.save_excel(corpus.output_path + 'wordlist.xlsx')
@@ -0,0 +1,5 @@
1
+ from kitconc.kit_corpus import Corpus
2
+ corpus = Corpus('kitconc_workspace','ads','english')
3
+ keywords = corpus.keywords(verbose=True)
4
+ print(keywords.df.head(10))
5
+ keywords.save_excel(corpus.output_path + 'keywords.xlsx')
@@ -0,0 +1,6 @@
1
+ from kitconc.kit_corpus import Corpus
2
+ corpus = Corpus('kitconc_workspace','ads','english')
3
+ kwic = corpus.kwic('experience',verbose=True)
4
+ kwic.sort('R1','R2','R3')
5
+ print(kwic.df.head(10))
6
+ kwic.save_excel(corpus.output_path + 'kwic.xlsx',highlight='R1 R2 R3')
@@ -0,0 +1,5 @@
1
+ from kitconc.kit_corpus import Corpus
2
+ corpus = Corpus('kitconc_workspace','ads','english')
3
+ concordances = corpus.concordance('experience',verbose=True)
4
+ print(concordances.df.head(10))
5
+ concordances.save_excel(corpus.output_path + 'concordances.xlsx')
@@ -0,0 +1,5 @@
1
+ from kitconc.kit_corpus import Corpus
2
+ corpus = Corpus('kitconc_workspace','ads','english')
3
+ collocates = corpus.collocates('experience',left_span=2,right_span=2,coll_pos='IN NN JJ VBN VBD',verbose=True)
4
+ print(collocates.df.head(10))
5
+ collocates.save_excel(corpus.output_path + 'collocates.xlsx')
@@ -0,0 +1,5 @@
1
+ from kitconc.kit_corpus import Corpus
2
+ corpus = Corpus('kitconc_workspace','ads','english')
3
+ clusters = corpus.clusters('experience',size=3,verbose=True)
4
+ print(clusters.df.head(10))
5
+ clusters.save_excel(corpus.output_path + 'clusters.xlsx')
@@ -0,0 +1,5 @@
1
+ from kitconc.kit_corpus import Corpus
2
+ corpus = Corpus('kitconc_workspace','ads','english')
3
+ ngrams = corpus.ngrams(size=3,pos='NN IN NN',verbose=True)
4
+ print(ngrams.df.head(10))
5
+ ngrams.save_excel(corpus.output_path + 'ngrams.xlsx')
@@ -0,0 +1,5 @@
1
+ from kitconc.kit_corpus import Corpus
2
+ corpus = Corpus('kitconc_workspace','ads','english')
3
+ dispersion = corpus.dispersion('salary')
4
+ print(dispersion.df.head(10))
5
+ dispersion.save_excel(corpus.output_path + 'dispersion.xlsx')
@@ -0,0 +1,8 @@
1
+ from kitconc.kit_corpus import Corpus
2
+ corpus = Corpus('kitconc_workspace','ads','english')
3
+ kwic = corpus.kwic('skills',verbose=True)
4
+ collocations = corpus.collocations(kwic,verbose=True)
5
+ print(collocations.df.head(10))
6
+ collocations.save_excel(corpus.output_path+'collocations.xlsx')
7
+ # plot a collocate distribution
8
+ collocations.plot_colldist('strong')
@@ -0,0 +1,7 @@
1
+ from kitconc.kit_corpus import Corpus
2
+ corpus = Corpus('kitconc_workspace','ads','english')
3
+ collocates = corpus.collocates('skills',left_span=3,right_span=3,coll_pos='NN JJ',verbose=True)
4
+ print(collocates.df.head(10))
5
+ collocates.save_excel(corpus.output_path + 'collocates.xlsx')
6
+ # plot collocates
7
+ collocates.plot_collgraph(node='skills')
@@ -0,0 +1,10 @@
1
+ from kitconc.kit_corpus import Corpus
2
+ corpus = Corpus('kitconc_workspace','ads', 'english')
3
+ ids = list(corpus.fileids())
4
+ words_from_first_file = list(corpus.words(ids[0]))
5
+ for word in words_from_first_file:
6
+ print(word)
7
+
8
+ # tagged words
9
+ for tagged_word in corpus.tagged_words(1):
10
+ print(tagged_word)
@@ -0,0 +1,9 @@
1
+ from kitconc.kit_corpus import Corpus
2
+ corpus = Corpus('kitconc_workspace','ads', 'english')
3
+ sents = list(corpus.sents(1)) # sents from first file
4
+ for sent in sents:
5
+ print(sent)
6
+
7
+ # tagged sents
8
+ for sent in corpus.tagged_sents(1):
9
+ print(sent)
@@ -0,0 +1,11 @@
1
+ from kitconc.kit_spacy import create_corpus
2
+
3
+ # Creates a corpus with spaCy POS
4
+
5
+ create_corpus('kitconc_workspace', # workspade
6
+ 'job_ads', # corpus name
7
+ 'kitconc_corpora/ads', # texts folder
8
+ 'english', # language
9
+ 'en_core_web_trf', # spaCy model
10
+ verbose=True)
11
+
@@ -0,0 +1,27 @@
1
+ import os
2
+ from kitconc.kit_corpus import Corpus
3
+ import kitconc.kit_util
4
+
5
+ # 1:
6
+ # First let's create a tagged corpus for demo
7
+ if not os.path.exists('kitconc_corpora/tagged_sents'):
8
+ os.mkdir('kitconc_corpora/tagged_sents')
9
+
10
+ corpus = Corpus('kitconc_workspace','ads', 'english')
11
+ ids = list(corpus.fileids())
12
+
13
+ for file_id in ids:
14
+ s = []
15
+ for tagged_sent in corpus.tagged_sents():
16
+ str_sent = ' '.join([f'{token[0]}/{token[1]}' for token in tagged_sent])
17
+ s.append(str_sent)
18
+ with open('kitconc_corpora/tagged_sents/file_' + str(file_id) + '.txt', 'w', encoding='utf-8') as fh:
19
+ fh.write('\n'.join(s))
20
+
21
+ # 2:
22
+ # Now, let's load the tagged corpus and make a wordlist
23
+ new_corpus = Corpus('kitconc_workspace', 'job_ads', 'english')
24
+ new_corpus.add_texts('kitconc_corpora/tagged_sents', tagged = True, verbose=True)
25
+ wordlist = new_corpus.wordlist()
26
+ print(wordlist.df.head(10))
27
+
@@ -0,0 +1,36 @@
1
+ import os
2
+ from kitconc.kit_corpus import Corpus
3
+ import kitconc.kit_util
4
+
5
+ # first let's create a tagged corpus for demo
6
+ if not os.path.exists('kitconc_corpora/tagged_sents'):
7
+ os.mkdir('kitconc_corpora/tagged_sents')
8
+
9
+ corpus = Corpus('kitconc_workspace','ads', 'english')
10
+ ids = list(corpus.fileids())
11
+
12
+ for file_id in ids:
13
+ s = []
14
+ for tagged_sent in corpus.tagged_sents():
15
+ str_sent = ' '.join([f'{token[0]}/{token[1]}' for token in tagged_sent])
16
+ s.append(str_sent)
17
+ with open('kitconc_corpora/tagged_sents/file_' + str(file_id) + '.txt', 'w', encoding='utf-8') as fh:
18
+ fh.write('\n'.join(s))
19
+
20
+ # now let's train the model
21
+
22
+ from kitconc.kit_models import Models
23
+
24
+ models = Models()
25
+ models.create_model('kitconc_corpora/tagged_sents', 'english-ads', verbose=True)
26
+
27
+ # Remove the model
28
+ #models.remove_model('english-ads')
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
@@ -0,0 +1,3 @@
1
+ from kitconc.kit_corpus import Corpus
2
+ corpus = Corpus('kitconc_workspace','ads','english')
3
+ corpus.export('kitconc_corpora', verbose=True)
@@ -0,0 +1,4 @@
1
+ from kitconc.kit_corpus import Corpus
2
+
3
+ corpus = Corpus()
4
+ corpus.add_from_export('kitconc_corpora/ads.zip', verbose=True)
@@ -0,0 +1,12 @@
1
+ from kitconc.kit_corpus import Corpus
2
+ corpus = Corpus('kitconc_workspace','ads','english')
3
+ # keywords against the bundled reference list, with an effect size and a significance threshold
4
+ keywords = corpus.keywords(effect=['log-ratio','log-dice'],p_value='p<0.01',verbose=True)
5
+ print(keywords.df.head(10))
6
+ # negative keywords (words unusually infrequent in the corpus)
7
+ negative = corpus.keywords(polarity='negative',min_freq=3)
8
+ print(negative.df.head(10))
9
+ # keywords against another corpus of the same workspace (e.g. corpus 'reference'):
10
+ # keywords = corpus.keywords(ref_corpus='reference',effect='log-ratio')
11
+ # keywords = corpus.keywords(measure='text-dispersion',ref_corpus='reference')
12
+ keywords.save_excel(corpus.output_path + 'keywords_effect.xlsx')
@@ -0,0 +1,12 @@
1
+ from kitconc.kit_corpus import Corpus
2
+ corpus = Corpus('kitconc_workspace','ads','english')
3
+ # wildcards: * (any characters), ? (one character), + (zero or one character), a|b, [a,b]
4
+ kwic = corpus.kwic('develop*',wildcards=True,verbose=True)
5
+ print(kwic.df.head(10))
6
+ # context search: lines of 'experience' with 'years' up to 3 words to the left or right
7
+ kwic = corpus.kwic('experience',context=['years'],context_span=(3,3))
8
+ print(len(kwic.df))
9
+ # random sample and KWIC pattern frequency (most frequent R1 R2 patterns first)
10
+ kwic = corpus.kwic('experience',sample=30,seed=1).kpf('R1','R2',None)
11
+ print(kwic.df[['NODE','RIGHT','PATTERN','KPF']].head(10))
12
+ kwic.save_excel(corpus.output_path + 'kwic_kpf.xlsx')
@@ -0,0 +1,12 @@
1
+ from kitconc.kit_corpus import Corpus
2
+ corpus = Corpus('kitconc_workspace','ads','english')
3
+ # corpus-level dispersion of a search term (range, Juilland's D, Gries' DP)
4
+ dispersion = corpus.dispersion('experience')
5
+ print(dispersion.stats)
6
+ # dispersion measures for several words
7
+ measures = corpus.dispersion_measures(['experience','skills','team'])
8
+ print(measures.df)
9
+ # wordlist with RANGE, JUILLAND_D and DP columns, without stopwords
10
+ wordlist = corpus.wordlist(dispersion=True,stoplist='default')
11
+ print(wordlist.df.head(10))
12
+ measures.save_excel(corpus.output_path + 'dispersion_measures.xlsx')
@@ -0,0 +1,13 @@
1
+ from kitconc.kit_corpus import Corpus
2
+ corpus = Corpus('kitconc_workspace','ads','english')
3
+ # clusters of any size with the search word on the left (or position='right')
4
+ clusters = corpus.clusters('experience',size=4,position='left')
5
+ print(clusters.df.head(10))
6
+ # p-frames: n-grams with open slots, e.g. "the * of"
7
+ pframes = corpus.pframes(size=3,slots=[2],verbose=True)
8
+ print(pframes.df.head(10))
9
+ # lemma list (bundled English list or lemma_file='my_lemmas.txt' in headword-forms format)
10
+ lemmas = corpus.lemmalist()
11
+ print(lemmas.df.head(10))
12
+ pframes.save_excel(corpus.output_path + 'pframes.xlsx')
13
+ lemmas.save_excel(corpus.output_path + 'lemmas.xlsx')
@@ -0,0 +1,10 @@
1
+ from kitconc.kit_corpus import Corpus
2
+ corpus = Corpus('kitconc_workspace','ads','english')
3
+ # word cloud of the wordlist (without stopwords) saved in the output folder
4
+ corpus.wordcloud(filename='wordcloud.png')
5
+ # word cloud of the keywords
6
+ corpus.wordcloud(corpus.keywords(polarity='positive'),'keywords_cloud.png',colormap='plasma')
7
+ # text of one file with the hits of a search term marked
8
+ view = corpus.fileview('ad_000.txt','experience')
9
+ print(view.hits, view.tokens)
10
+ print(view.text)
@@ -385,8 +385,9 @@ class CorpusToolsMixin:
385
385
  outlier_factor: Annotated[float, Field(gt=1, description="Texts longer than this times the median are "
386
386
  "flagged.")] = 10.0,
387
387
  ) -> dict[str, Any]:
388
- """Quality check of a corpus: non-text files ingested by mistake, duplicates, too short/long texts,
389
- garbled encoding, metadata mismatches and untagged data. Returns issues with severity and a
388
+ """Quality check of a corpus: predominantly non-word content, duplicates, too short/long texts,
389
+ garbled encoding, metadata mismatches and untagged data. The non_text check uses token content,
390
+ not file extensions; readable TSV/CSV files may be classified as too_short. Returns issues with severity and a
390
391
  per-text statistics result (stats_result_id)."""
391
392
  data = self._corpus_data(corpus)
392
393
  info = self.actions.get_corpus_info(data.name)
@@ -50,3 +50,25 @@ not fixed reports: show one, change what the question needs, run the variant or
50
50
  ```
51
51
 
52
52
  Names use lowercase letters, digits, `-` and `_`. `recipe_save` validates the pipeline before saving.
53
+
54
+ ## Creating a recipe with an assistant
55
+
56
+ The `kitconc-recipe-author` Agent Skill guides recipe creation in Claude and Codex. Describe the
57
+ outcome you want in ordinary language; the assistant can check available corpora and existing
58
+ recipes, draft the pipeline, validate it, optionally run it, and save it in the active workspace.
59
+ The skill is installed alongside the general Kitconc skill by `kitconc-skill install`.
60
+
61
+ Example requests:
62
+
63
+ - “Create a reusable recipe that finds adjective–noun terms occurring at least three times and
64
+ adds example contexts.”
65
+ - “Adapt `glossary-candidates` to compare terms with corpus `general-en`, validate the result, and
66
+ save it as `legal-glossary-contrast`.”
67
+ - “Draft a recipe to compare `period-a` and `period-b` using normalized frequencies and log ratio;
68
+ show me the steps before saving.”
69
+
70
+ The assistant should confirm corpus ids and available tools, explain the parameters and analysis
71
+ choices, and call `pipeline_validate` before execution or persistence. Validation checks pipeline
72
+ structure and references; it does not establish that an interpretation is statistically or
73
+ linguistically sound. `recipe_save` writes the JSON recipe to `<workspace>/recipes/`. Ask for a
74
+ draft if you want the JSON without saving it.
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: kitconc-recipe-author
3
+ description: Help users design, validate, run, and save reusable Kitconc analysis recipes. Use when a user asks to create, customize, refine, or troubleshoot a Kitconc recipe or multi-step corpus workflow, especially when they want to reuse or share it.
4
+ ---
5
+
6
+ # Kitconc recipe author
7
+
8
+ Turn a user's analysis goal into a small, understandable, reusable Kitconc recipe. A recipe is a
9
+ JSON pipeline. Use the Kitconc MCP tools when available; otherwise use `kitconc-tool` with the same
10
+ arguments. If neither is available, explain how to connect Kitconc or install its CLI before
11
+ claiming that a recipe was validated or saved.
12
+
13
+ ## Workflow
14
+
15
+ 1. **Understand the goal.** Identify the corpus or corpora, the question, desired output, filters,
16
+ measures, and whether the workflow should be saved. Ask only for information needed to make the
17
+ workflow meaningful. Do not invent corpus ids, tool names, fields, or parameters.
18
+ 2. **Check available evidence and tools.** Use `workspace_info` to discover corpus ids and
19
+ `recipe_list` to find an existing recipe that can be reused. Read a relevant guide with
20
+ `guide_read` (`recipes`, `pipelines`, `expressions`, or `measures`) when needed. Use
21
+ `recipe_show` to inspect a candidate recipe. If the user refers to a specific corpus, confirm it
22
+ exists before building around it.
23
+ 3. **Design the smallest useful workflow.** Prefer a built-in recipe as a starting point. Otherwise
24
+ compose supported tools into ordered `steps`; declare meaningful `params`; give each step a
25
+ stable `id`; connect outputs with references such as `$params.corpus` and
26
+ `$terms.result_id`; set `output` to the useful final step; and write an `interpretation` that
27
+ describes how to read the result without overstating it. Avoid unnecessary steps and huge inline
28
+ tables. For list-like inputs, preserve their list type in parameter references.
29
+ 4. **Explain the proposal.** Show the recipe name, the question it answers, required inputs, and
30
+ the main analysis choices. Clearly label choices that remain assumptions. The user can review
31
+ this before persistence when the request is only to draft or explore.
32
+ 5. **Validate.** Call `pipeline_validate` with the proposed recipe/pipeline and representative
33
+ parameter values where available. Resolve validation errors by checking the current tool
34
+ schemas and guides; do not guess. Validation checks structure and references, not whether the
35
+ corpus supports a scientifically sound interpretation.
36
+ 6. **Run when useful.** If the user requested a working recipe and the corpus is available, run it
37
+ with `pipeline_run` (or `recipe_run` after saving). For a long-running workflow, use `job_start`
38
+ if MCP is available. Inspect the step statuses and a manageable sample of the output; adjust
39
+ parameters or steps when results expose a problem. Distinguish a successful run from a
40
+ scientifically reviewed result.
41
+ 7. **Save when requested.** Use `recipe_save` with the complete recipe object. Choose a unique,
42
+ lowercase name using letters, digits, hyphens, or underscores. If that user recipe already
43
+ exists, explain that `overwrite: true` is needed and use it only when the user asked to replace
44
+ it. Avoid names matching built-in recipes because user recipes with those names override them.
45
+ Report the saved path returned by the tool. If the user only asked for a draft, provide the JSON
46
+ without saving.
47
+ 8. **Summarize plainly.** Report what the recipe does, its inputs, validation/run status, and whether
48
+ it was saved. Include limitations and any assumptions that affect interpretation.
49
+
50
+ ## Recipe structure
51
+
52
+ Use the schema and tool list exposed by Kitconc rather than relying on memory. A typical recipe has
53
+ `name`, `title`, `description`, `tags`, `params`, `steps`, `output`, and `interpretation`. The
54
+ `steps` array uses the same format as `pipeline_run`; `recipe_save` validates before writing it to
55
+ `<workspace>/recipes/<name>.json`.
56
+
57
+ For CLI use, call the same operations with `kitconc-tool`; each tool takes its arguments as a JSON
58
+ object, and complex requests can be provided through stdin with `-`. Use `kitconc-tool --list` to
59
+ confirm available operations. For detailed syntax and a complete example, consult the Kitconc
60
+ `recipes` and `pipelines` guides.
@@ -20,53 +20,57 @@ import shutil
20
20
  import sys
21
21
  from pathlib import Path
22
22
 
23
- SKILL_NAME = "kitconc"
24
- SKILL_SOURCE = Path(__file__).resolve().parent / "skill" / SKILL_NAME
23
+ SKILL_NAMES = ("kitconc", "kitconc-recipe-author")
24
+ SKILL_ROOT = Path(__file__).resolve().parent / "skill"
25
+ SKILL_NAME = "kitconc" # Backwards-compatible name for the main bundled skill.
26
+ SKILL_SOURCE = SKILL_ROOT / SKILL_NAME
25
27
  TARGETS = {
26
28
  "claude": {"user": Path.home() / ".claude" / "skills", "project": Path(".claude") / "skills"},
27
29
  "codex": {"user": Path.home() / ".agents" / "skills", "project": Path(".agents") / "skills"},
28
30
  }
29
31
 
30
32
 
31
- def install(dest_root: Path, force: bool = False) -> Path:
32
- """Copies the skill folder into ``dest_root/kitconc``; returns the installed path."""
33
- if not (SKILL_SOURCE / "SKILL.md").is_file():
34
- raise FileNotFoundError(f"Bundled skill not found at {SKILL_SOURCE}")
35
- target = dest_root / SKILL_NAME
33
+ def install(dest_root: Path, force: bool = False, skill_name: str = SKILL_NAME) -> Path:
34
+ """Copy one bundled skill folder into ``dest_root`` and return its installed path."""
35
+ source = SKILL_ROOT / skill_name
36
+ if skill_name not in SKILL_NAMES or not (source / "SKILL.md").is_file():
37
+ raise FileNotFoundError(f"Bundled skill not found: {skill_name}")
38
+ target = dest_root / skill_name
36
39
  if target.exists():
37
40
  if not force:
38
41
  raise FileExistsError(f"{target} already exists (use --force to replace it)")
39
42
  shutil.rmtree(target)
40
43
  dest_root.mkdir(parents=True, exist_ok=True)
41
- shutil.copytree(SKILL_SOURCE, target, ignore=shutil.ignore_patterns("__pycache__", "*.pyc"))
44
+ shutil.copytree(source, target, ignore=shutil.ignore_patterns("__pycache__", "*.pyc"))
42
45
  return target
43
46
 
44
47
 
45
48
  def main(argv: list[str] | None = None) -> int:
46
- parser = argparse.ArgumentParser(prog="kitconc-skill", description="Install the Kitconc agent skill.")
49
+ parser = argparse.ArgumentParser(prog="kitconc-skill", description="Install Kitconc agent skills.")
47
50
  sub = parser.add_subparsers(dest="command", required=True)
48
- inst = sub.add_parser("install", help="Copy the skill into Claude and/or Codex skill folders")
51
+ inst = sub.add_parser("install", help="Copy Kitconc skills into Claude and/or Codex skill folders")
49
52
  inst.add_argument("--target", choices=["all", "claude", "codex"], default="all")
50
53
  inst.add_argument("--scope", choices=["user", "project"], default="user",
51
54
  help="user = home folder; project = current directory")
52
55
  inst.add_argument("--dest", default=None, help="Install into this skills folder instead")
53
56
  inst.add_argument("--force", action="store_true", help="Replace an existing installation")
54
- sub.add_parser("path", help="Print the folder of the bundled skill")
57
+ sub.add_parser("path", help="Print the folder containing the bundled skills")
55
58
  args = parser.parse_args(argv)
56
59
 
57
60
  if args.command == "path":
58
- print(SKILL_SOURCE)
61
+ print(SKILL_ROOT)
59
62
  return 0
60
63
  roots = [Path(args.dest)] if args.dest else [
61
64
  TARGETS[name][args.scope] for name in (["claude", "codex"] if args.target == "all" else [args.target])
62
65
  ]
63
66
  status = 0
64
67
  for root in roots:
65
- try:
66
- print(f"installed: {install(root.resolve(), force=args.force)}")
67
- except (FileExistsError, FileNotFoundError, OSError) as exc:
68
- print(f"skipped: {exc}", file=sys.stderr)
69
- status = 1
68
+ for skill_name in SKILL_NAMES:
69
+ try:
70
+ print(f"installed: {install(root.resolve(), force=args.force, skill_name=skill_name)}")
71
+ except (FileExistsError, FileNotFoundError, OSError) as exc:
72
+ print(f"skipped: {exc}", file=sys.stderr)
73
+ status = 1
70
74
  return status
71
75
 
72
76
 
@@ -56,9 +56,16 @@ from kitconc import py_measures
56
56
  from kitconc import py_extras
57
57
 
58
58
 
59
- def _run_pipeline(command, stage):
59
+ def _run_pipeline(command, stage, timeout=1800):
60
60
  """Run one indexing stage and surface failures with the stage name."""
61
- result = subprocess.run(command, capture_output=True, text=True, encoding='utf-8', errors='replace')
61
+ try:
62
+ result = subprocess.run(
63
+ command, stdin=subprocess.DEVNULL, close_fds=True,
64
+ capture_output=True, text=True, encoding='utf-8', errors='replace',
65
+ timeout=timeout,
66
+ )
67
+ except subprocess.TimeoutExpired as exc:
68
+ raise RuntimeError(f"Corpus {stage} timed out after {timeout} seconds.") from exc
62
69
  if result.returncode != 0:
63
70
  detail = (result.stderr or result.stdout or '').strip()
64
71
  raise RuntimeError(
@@ -441,6 +448,9 @@ class Corpus (object):
441
448
  tagged = kwargs.get('tagged', False)
442
449
  language_model = kwargs.get('language_model', None)
443
450
  verbose = kwargs.get('verbose', False)
451
+ # add_texts cleans these folders after each run, including on existing objects.
452
+ for name in ('tmp1', 'tmp2', 'tmp3'):
453
+ (Path(self.workspace) / self.corpus_name / 'data' / name).mkdir(parents=True, exist_ok=True)
444
454
  if not source_folder.endswith('/'):
445
455
  source_folder = source_folder + '/'
446
456
 
@@ -551,6 +561,14 @@ class Corpus (object):
551
561
  position = next((i + 1 for i, (key, _) in enumerate(pairs) if key.lower() == 'encoding'), len(pairs))
552
562
  pairs[position:position] = [('Textfiles', total_texts), ('Source', original_source)]
553
563
  kit_util.write_info_tab(str(info_path), pairs)
564
+
565
+ # Indexing changes word ids and frequencies; old wordlist caches are invalid.
566
+ idx_path = Path(self.workspace) / self.corpus_name / 'data' / 'idx'
567
+ for filename in ('wordlist.pickle', 'wordlistlc.pickle', 'info.pickle'):
568
+ (idx_path / filename).unlink(missing_ok=True)
569
+ # Persist the same lowercase statistics used by the default wordlist before
570
+ # create/add_texts returns, rather than waiting for the first analysis.
571
+ make_wordlist(self.workspace, self.corpus_name, self.language)
554
572
 
555
573
  # Time end and print total time if progress display is enabled
556
574
  if verbose:
@@ -26,6 +26,8 @@ def count_words(npy_path: str) -> Dict[int, int]:
26
26
  files = os.listdir(npy_path)
27
27
  for filename in files:
28
28
  arr=np.load(npy_path + filename)
29
+ if arr.size == 0:
30
+ continue
29
31
  i,c = np.unique(arr[:,0], return_counts=True)
30
32
  for x in range(i.shape[0]):
31
33
  if i[x] in counter:
@@ -101,7 +103,7 @@ def make_wordlist(workspace: str, corpus_name: str, language: str, lowercase: bo
101
103
  hapax+=1
102
104
  word_count = None
103
105
  dict_words = None
104
- type_token = (types/float(tokens))*100
106
+ type_token = (types/float(tokens))*100 if tokens else 0.0
105
107
 
106
108
  if os.path.exists(workspace + corpus_name + '/data/idx/wordlistlc.pickle') == False and lowercase == True:
107
109
  with open(workspace + corpus_name + '/data/idx/wordlistlc.pickle','wb') as fh:
@@ -1,3 +1,3 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # Author: jlopes@alumni.usp.br
3
- __version__ = '4.0.0'
3
+ __version__ = '4.0.2'