@wentorai/research-plugins 1.0.0 → 1.1.0

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 (203) hide show
  1. package/README.md +22 -22
  2. package/curated/analysis/README.md +71 -56
  3. package/curated/domains/README.md +176 -67
  4. package/curated/literature/README.md +71 -47
  5. package/curated/research/README.md +91 -58
  6. package/curated/tools/README.md +88 -87
  7. package/curated/writing/README.md +80 -45
  8. package/mcp-configs/cloud-docs/confluence-mcp.json +37 -0
  9. package/mcp-configs/cloud-docs/google-drive-mcp.json +35 -0
  10. package/mcp-configs/cloud-docs/notion-mcp.json +29 -0
  11. package/mcp-configs/communication/discord-mcp.json +29 -0
  12. package/mcp-configs/communication/slack-mcp.json +29 -0
  13. package/mcp-configs/communication/telegram-mcp.json +28 -0
  14. package/mcp-configs/database/neo4j-mcp.json +37 -0
  15. package/mcp-configs/database/postgres-mcp.json +28 -0
  16. package/mcp-configs/database/sqlite-mcp.json +29 -0
  17. package/mcp-configs/dev-platform/github-mcp.json +31 -0
  18. package/mcp-configs/dev-platform/gitlab-mcp.json +34 -0
  19. package/mcp-configs/email/email-mcp.json +40 -0
  20. package/mcp-configs/email/gmail-mcp.json +37 -0
  21. package/mcp-configs/registry.json +178 -149
  22. package/mcp-configs/repository/dataverse-mcp.json +33 -0
  23. package/mcp-configs/repository/huggingface-mcp.json +29 -0
  24. package/openclaw.plugin.json +2 -2
  25. package/package.json +2 -2
  26. package/skills/analysis/dataviz/algorithm-visualizer-guide/SKILL.md +259 -0
  27. package/skills/analysis/dataviz/bokeh-visualization-guide/SKILL.md +270 -0
  28. package/skills/analysis/dataviz/chart-image-generator/SKILL.md +229 -0
  29. package/skills/analysis/dataviz/d3-visualization-guide/SKILL.md +281 -0
  30. package/skills/analysis/dataviz/echarts-visualization-guide/SKILL.md +250 -0
  31. package/skills/analysis/dataviz/metabase-analytics-guide/SKILL.md +242 -0
  32. package/skills/analysis/dataviz/plotly-interactive-guide/SKILL.md +266 -0
  33. package/skills/analysis/dataviz/redash-analytics-guide/SKILL.md +284 -0
  34. package/skills/analysis/econometrics/econml-causal-guide/SKILL.md +163 -0
  35. package/skills/analysis/econometrics/mostly-harmless-guide/SKILL.md +139 -0
  36. package/skills/analysis/econometrics/panel-data-analyst/SKILL.md +259 -0
  37. package/skills/analysis/econometrics/python-causality-guide/SKILL.md +134 -0
  38. package/skills/analysis/econometrics/stata-accounting-guide/SKILL.md +269 -0
  39. package/skills/analysis/econometrics/stata-analyst-guide/SKILL.md +245 -0
  40. package/skills/analysis/statistics/data-anomaly-detection/SKILL.md +157 -0
  41. package/skills/analysis/statistics/ml-experiment-tracker/SKILL.md +212 -0
  42. package/skills/analysis/statistics/pywayne-statistics-guide/SKILL.md +192 -0
  43. package/skills/analysis/statistics/quantitative-methods-guide/SKILL.md +193 -0
  44. package/skills/analysis/statistics/senior-data-scientist-guide/SKILL.md +223 -0
  45. package/skills/analysis/wrangling/csv-data-analyzer/SKILL.md +170 -0
  46. package/skills/analysis/wrangling/data-cleaning-pipeline/SKILL.md +266 -0
  47. package/skills/analysis/wrangling/data-cog-guide/SKILL.md +178 -0
  48. package/skills/analysis/wrangling/stata-data-cleaning/SKILL.md +276 -0
  49. package/skills/analysis/wrangling/survey-data-processing/SKILL.md +298 -0
  50. package/skills/domains/ai-ml/ai-model-benchmarking/SKILL.md +209 -0
  51. package/skills/domains/ai-ml/annotated-dl-papers-guide/SKILL.md +159 -0
  52. package/skills/domains/ai-ml/dl-transformer-finetune/SKILL.md +239 -0
  53. package/skills/domains/ai-ml/generative-ai-guide/SKILL.md +146 -0
  54. package/skills/domains/ai-ml/huggingface-inference-guide/SKILL.md +196 -0
  55. package/skills/domains/ai-ml/keras-deep-learning/SKILL.md +210 -0
  56. package/skills/domains/ai-ml/llm-from-scratch-guide/SKILL.md +124 -0
  57. package/skills/domains/ai-ml/ml-pipeline-guide/SKILL.md +295 -0
  58. package/skills/domains/ai-ml/nlp-toolkit-guide/SKILL.md +247 -0
  59. package/skills/domains/ai-ml/pytorch-guide/SKILL.md +281 -0
  60. package/skills/domains/ai-ml/pytorch-lightning-guide/SKILL.md +244 -0
  61. package/skills/domains/ai-ml/tensorflow-guide/SKILL.md +241 -0
  62. package/skills/domains/biomedical/bioagents-guide/SKILL.md +308 -0
  63. package/skills/domains/biomedical/medgeclaw-guide/SKILL.md +345 -0
  64. package/skills/domains/biomedical/medical-imaging-guide/SKILL.md +305 -0
  65. package/skills/domains/business/architecture-design-guide/SKILL.md +279 -0
  66. package/skills/domains/business/innovation-management-guide/SKILL.md +257 -0
  67. package/skills/domains/business/operations-research-guide/SKILL.md +258 -0
  68. package/skills/domains/chemistry/molecular-dynamics-guide/SKILL.md +237 -0
  69. package/skills/domains/chemistry/pubchem-api-guide/SKILL.md +180 -0
  70. package/skills/domains/chemistry/spectroscopy-analysis-guide/SKILL.md +290 -0
  71. package/skills/domains/cs/distributed-systems-guide/SKILL.md +268 -0
  72. package/skills/domains/cs/formal-verification-guide/SKILL.md +298 -0
  73. package/skills/domains/ecology/species-distribution-guide/SKILL.md +343 -0
  74. package/skills/domains/economics/imf-data-api-guide/SKILL.md +174 -0
  75. package/skills/domains/economics/post-labor-economics/SKILL.md +254 -0
  76. package/skills/domains/economics/pricing-psychology-guide/SKILL.md +273 -0
  77. package/skills/domains/economics/world-bank-data-guide/SKILL.md +179 -0
  78. package/skills/domains/education/assessment-design-guide/SKILL.md +213 -0
  79. package/skills/domains/education/educational-research-methods/SKILL.md +179 -0
  80. package/skills/domains/education/mooc-analytics-guide/SKILL.md +206 -0
  81. package/skills/domains/finance/portfolio-optimization-guide/SKILL.md +279 -0
  82. package/skills/domains/finance/risk-modeling-guide/SKILL.md +260 -0
  83. package/skills/domains/finance/stata-accounting-research/SKILL.md +372 -0
  84. package/skills/domains/geoscience/climate-modeling-guide/SKILL.md +215 -0
  85. package/skills/domains/geoscience/satellite-remote-sensing/SKILL.md +193 -0
  86. package/skills/domains/geoscience/seismology-data-guide/SKILL.md +208 -0
  87. package/skills/domains/humanities/ethical-philosophy-guide/SKILL.md +244 -0
  88. package/skills/domains/humanities/history-research-guide/SKILL.md +260 -0
  89. package/skills/domains/humanities/political-history-guide/SKILL.md +241 -0
  90. package/skills/domains/law/legal-nlp-guide/SKILL.md +236 -0
  91. package/skills/domains/law/patent-analysis-guide/SKILL.md +257 -0
  92. package/skills/domains/law/regulatory-compliance-guide/SKILL.md +267 -0
  93. package/skills/domains/math/symbolic-computation-guide/SKILL.md +263 -0
  94. package/skills/domains/math/topology-data-analysis/SKILL.md +305 -0
  95. package/skills/domains/pharma/clinical-trial-design-guide/SKILL.md +271 -0
  96. package/skills/domains/pharma/drug-target-interaction/SKILL.md +242 -0
  97. package/skills/domains/pharma/pharmacovigilance-guide/SKILL.md +216 -0
  98. package/skills/domains/physics/astrophysics-data-guide/SKILL.md +305 -0
  99. package/skills/domains/physics/particle-physics-guide/SKILL.md +287 -0
  100. package/skills/domains/social-science/network-analysis-guide/SKILL.md +310 -0
  101. package/skills/domains/social-science/psychology-research-guide/SKILL.md +270 -0
  102. package/skills/domains/social-science/sociology-research-guide/SKILL.md +238 -0
  103. package/skills/literature/discovery/paper-recommendation-guide/SKILL.md +120 -0
  104. package/skills/literature/discovery/semantic-paper-radar/SKILL.md +144 -0
  105. package/skills/literature/discovery/zotero-arxiv-daily-guide/SKILL.md +94 -0
  106. package/skills/literature/fulltext/core-api-guide/SKILL.md +144 -0
  107. package/skills/literature/fulltext/institutional-repository-guide/SKILL.md +212 -0
  108. package/skills/literature/fulltext/open-access-mining-guide/SKILL.md +341 -0
  109. package/skills/literature/metadata/academic-paper-summarizer/SKILL.md +101 -0
  110. package/skills/literature/metadata/wikidata-api-guide/SKILL.md +156 -0
  111. package/skills/literature/search/arxiv-batch-reporting/SKILL.md +133 -0
  112. package/skills/literature/search/arxiv-paper-processor/SKILL.md +141 -0
  113. package/skills/literature/search/baidu-scholar-guide/SKILL.md +110 -0
  114. package/skills/literature/search/chatpaper-guide/SKILL.md +122 -0
  115. package/skills/literature/search/deep-literature-search/SKILL.md +149 -0
  116. package/skills/literature/search/deepgit-search-guide/SKILL.md +147 -0
  117. package/skills/literature/search/pasa-paper-search-guide/SKILL.md +138 -0
  118. package/skills/research/automation/ai-scientist-v2-guide/SKILL.md +284 -0
  119. package/skills/research/automation/aim-experiment-guide/SKILL.md +234 -0
  120. package/skills/research/automation/datagen-research-guide/SKILL.md +131 -0
  121. package/skills/research/automation/kedro-pipeline-guide/SKILL.md +216 -0
  122. package/skills/research/automation/mle-agent-guide/SKILL.md +139 -0
  123. package/skills/research/automation/paper-to-agent-guide/SKILL.md +116 -0
  124. package/skills/research/automation/rd-agent-guide/SKILL.md +246 -0
  125. package/skills/research/automation/research-paper-orchestrator/SKILL.md +254 -0
  126. package/skills/research/deep-research/academic-deep-research/SKILL.md +190 -0
  127. package/skills/research/deep-research/auto-deep-research-guide/SKILL.md +141 -0
  128. package/skills/research/deep-research/deep-research-pro/SKILL.md +213 -0
  129. package/skills/research/deep-research/deep-research-work/SKILL.md +204 -0
  130. package/skills/research/deep-research/deep-searcher-guide/SKILL.md +253 -0
  131. package/skills/research/deep-research/gpt-researcher-guide/SKILL.md +191 -0
  132. package/skills/research/deep-research/khoj-research-guide/SKILL.md +200 -0
  133. package/skills/research/deep-research/local-deep-research-guide/SKILL.md +253 -0
  134. package/skills/research/deep-research/tongyi-deep-research-guide/SKILL.md +217 -0
  135. package/skills/research/funding/eu-horizon-guide/SKILL.md +244 -0
  136. package/skills/research/funding/grant-budget-guide/SKILL.md +284 -0
  137. package/skills/research/funding/nih-reporter-api-guide/SKILL.md +166 -0
  138. package/skills/research/funding/nsf-award-api-guide/SKILL.md +133 -0
  139. package/skills/research/methodology/academic-mentor-guide/SKILL.md +169 -0
  140. package/skills/research/methodology/claude-scientific-guide/SKILL.md +122 -0
  141. package/skills/research/methodology/deep-innovator-guide/SKILL.md +242 -0
  142. package/skills/research/methodology/osf-api-guide/SKILL.md +165 -0
  143. package/skills/research/methodology/research-paper-kb/SKILL.md +263 -0
  144. package/skills/research/methodology/research-town-guide/SKILL.md +263 -0
  145. package/skills/research/paper-review/automated-review-guide/SKILL.md +281 -0
  146. package/skills/research/paper-review/paper-compare-guide/SKILL.md +238 -0
  147. package/skills/research/paper-review/paper-digest-guide/SKILL.md +240 -0
  148. package/skills/research/paper-review/paper-research-assistant/SKILL.md +231 -0
  149. package/skills/research/paper-review/research-quality-filter/SKILL.md +261 -0
  150. package/skills/research/paper-review/review-response-guide/SKILL.md +275 -0
  151. package/skills/tools/code-exec/google-colab-guide/SKILL.md +276 -0
  152. package/skills/tools/code-exec/kaggle-api-guide/SKILL.md +216 -0
  153. package/skills/tools/code-exec/overleaf-cli-guide/SKILL.md +279 -0
  154. package/skills/tools/diagram/code-flow-visualizer/SKILL.md +197 -0
  155. package/skills/tools/diagram/excalidraw-diagram-guide/SKILL.md +170 -0
  156. package/skills/tools/diagram/json-data-visualizer/SKILL.md +270 -0
  157. package/skills/tools/diagram/mermaid-architect-guide/SKILL.md +219 -0
  158. package/skills/tools/diagram/tldraw-whiteboard-guide/SKILL.md +397 -0
  159. package/skills/tools/document/docsgpt-guide/SKILL.md +130 -0
  160. package/skills/tools/document/large-document-reader/SKILL.md +202 -0
  161. package/skills/tools/document/paper-parse-guide/SKILL.md +243 -0
  162. package/skills/tools/knowledge-graph/citation-network-builder/SKILL.md +244 -0
  163. package/skills/tools/knowledge-graph/concept-map-generator/SKILL.md +284 -0
  164. package/skills/tools/knowledge-graph/graphiti-guide/SKILL.md +219 -0
  165. package/skills/tools/ocr-translate/pdf-math-translate-guide/SKILL.md +141 -0
  166. package/skills/tools/ocr-translate/zotero-pdf-translate-guide/SKILL.md +95 -0
  167. package/skills/tools/ocr-translate/zotero-pdf2zh-guide/SKILL.md +143 -0
  168. package/skills/tools/scraping/dataset-finder-guide/SKILL.md +253 -0
  169. package/skills/tools/scraping/easy-spider-guide/SKILL.md +250 -0
  170. package/skills/tools/scraping/google-scholar-scraper/SKILL.md +255 -0
  171. package/skills/tools/scraping/repository-harvesting-guide/SKILL.md +310 -0
  172. package/skills/writing/citation/academic-citation-manager/SKILL.md +314 -0
  173. package/skills/writing/citation/jabref-reference-guide/SKILL.md +127 -0
  174. package/skills/writing/citation/jasminum-zotero-guide/SKILL.md +103 -0
  175. package/skills/writing/citation/obsidian-citation-guide/SKILL.md +164 -0
  176. package/skills/writing/citation/obsidian-zotero-guide/SKILL.md +137 -0
  177. package/skills/writing/citation/papersgpt-zotero-guide/SKILL.md +132 -0
  178. package/skills/writing/citation/papis-cli-guide/SKILL.md +213 -0
  179. package/skills/writing/citation/zotero-better-bibtex-guide/SKILL.md +107 -0
  180. package/skills/writing/citation/zotero-better-notes-guide/SKILL.md +121 -0
  181. package/skills/writing/citation/zotero-gpt-guide/SKILL.md +111 -0
  182. package/skills/writing/citation/zotero-mcp-guide/SKILL.md +164 -0
  183. package/skills/writing/citation/zotero-mdnotes-guide/SKILL.md +162 -0
  184. package/skills/writing/citation/zotero-reference-guide/SKILL.md +139 -0
  185. package/skills/writing/citation/zotero-scholar-guide/SKILL.md +294 -0
  186. package/skills/writing/citation/zotfile-attachment-guide/SKILL.md +140 -0
  187. package/skills/writing/composition/ml-paper-writing/SKILL.md +163 -0
  188. package/skills/writing/composition/paper-debugger-guide/SKILL.md +143 -0
  189. package/skills/writing/composition/scientific-writing-resources/SKILL.md +151 -0
  190. package/skills/writing/composition/scientific-writing-wrapper/SKILL.md +153 -0
  191. package/skills/writing/latex/latex-drawing-collection/SKILL.md +154 -0
  192. package/skills/writing/latex/latex-templates-collection/SKILL.md +159 -0
  193. package/skills/writing/latex/md-to-pdf-academic/SKILL.md +230 -0
  194. package/skills/writing/latex/tex-render-guide/SKILL.md +243 -0
  195. package/skills/writing/polish/academic-tone-guide/SKILL.md +209 -0
  196. package/skills/writing/polish/conciseness-editing-guide/SKILL.md +225 -0
  197. package/skills/writing/polish/paper-polish-guide/SKILL.md +160 -0
  198. package/skills/writing/templates/graphical-abstract-guide/SKILL.md +183 -0
  199. package/skills/writing/templates/novathesis-guide/SKILL.md +152 -0
  200. package/skills/writing/templates/scientific-article-pdf/SKILL.md +261 -0
  201. package/skills/writing/templates/sjtuthesis-guide/SKILL.md +197 -0
  202. package/skills/writing/templates/thuthesis-guide/SKILL.md +181 -0
  203. package/skills/literature/fulltext/repository-harvesting-guide/SKILL.md +0 -207
@@ -0,0 +1,241 @@
1
+ ---
2
+ name: political-history-guide
3
+ description: "Chinese and European political struggle history and comparative analysis"
4
+ metadata:
5
+ openclaw:
6
+ emoji: "🗳️"
7
+ category: "domains"
8
+ subcategory: "humanities"
9
+ keywords: ["political history", "comparative politics", "Chinese history", "European history", "state formation", "revolution"]
10
+ source: "https://plato.stanford.edu/entries/political-history/"
11
+ ---
12
+
13
+ # Political History Guide
14
+
15
+ ## Overview
16
+
17
+ Political history examines the struggle for power, the formation of states, the dynamics of revolution and reform, and the evolution of political ideas across time and space. This guide focuses on comparative political history, drawing on Chinese and European traditions to illuminate how different civilizations have organized political authority, managed conflict, and theorized the relationship between rulers and ruled.
18
+
19
+ Comparing Chinese and European political development is one of the most productive exercises in historical social science. Both civilizations produced sophisticated state systems, bureaucratic administrations, and political philosophies -- but through radically different paths. Understanding these divergences helps researchers avoid Eurocentric assumptions and develop more robust theories of political change.
20
+
21
+ This guide covers key periods and themes in both traditions, methods for comparative historical analysis, and the theoretical frameworks that scholars use to explain political transformation. It is designed for researchers working on political history, comparative politics, historical sociology, or area studies who need to engage with both traditions.
22
+
23
+ ## Chinese Political History: Key Periods
24
+
25
+ ### Imperial State Formation
26
+
27
+ | Period | Key Development | Significance |
28
+ |--------|----------------|--------------|
29
+ | Warring States (475-221 BCE) | Competing state systems, Legalism | Earliest bureaucratic experiments |
30
+ | Qin Unification (221-206 BCE) | Centralized empire, standardization | Template for imperial governance |
31
+ | Han Dynasty (206 BCE-220 CE) | Confucian-Legalist synthesis, civil service | "Confucianization" of the state |
32
+ | Tang Dynasty (618-907) | Imperial examination system, cosmopolitan empire | Meritocratic bureaucracy matured |
33
+ | Song Dynasty (960-1279) | Neo-Confucianism, commercial revolution | Civilian-military tension, reform debates |
34
+ | Ming Dynasty (1368-1644) | Autocratic centralization, eunuch politics | Limits of centralization |
35
+ | Qing Dynasty (1644-1912) | Multi-ethnic empire, late reform crisis | Confrontation with modernity |
36
+
37
+ ### Political Struggle in Late Imperial China
38
+
39
+ ```
40
+ The Wang Anshi Reforms (1069-1076) -- Paradigmatic reform struggle:
41
+
42
+ REFORMERS (New Policies faction):
43
+ - Wang Anshi, chief architect
44
+ - Goal: Strengthen the state against Jurchen/Liao military threat
45
+ - Policies: State loans to farmers, militia system, merchant taxes,
46
+ reform of examination content
47
+
48
+ CONSERVATIVES (Old Policies faction):
49
+ - Sima Guang, Su Shi, Ouyang Xiu
50
+ - Goal: Preserve Confucian moral governance, limit state intervention
51
+ - Argument: State activism corrupts both officials and people
52
+
53
+ DYNAMICS:
54
+ 1. Emperor Shenzong backs Wang Anshi (1069)
55
+ 2. Conservatives purged from court
56
+ 3. Policies implemented with mixed results
57
+ 4. Emperor dies (1085), conservatives recalled
58
+ 5. Reform faction returns (1094), purges conservatives
59
+ 6. Cycle of factional purges weakens Northern Song
60
+
61
+ ANALYTICAL FRAMEWORK:
62
+ - Not simply "progressive vs. conservative"
63
+ - Two competing visions of state-society relations
64
+ - Both grounded in Confucian political philosophy
65
+ - Structural issue: factional competition without institutional checks
66
+ ```
67
+
68
+ ## European Political History: Key Periods
69
+
70
+ ### State Formation and Political Struggle
71
+
72
+ | Period | Key Development | Significance |
73
+ |--------|----------------|--------------|
74
+ | Athenian democracy (5th c. BCE) | Direct democracy, citizen participation | Foundational political model |
75
+ | Roman Republic/Empire | Republican institutions, imperial autocracy | Mixed constitution theory |
76
+ | Feudalism (9th-15th c.) | Decentralized authority, vassal obligations | Fragmented sovereignty |
77
+ | Magna Carta (1215) | Limited royal authority | Constitutional principle |
78
+ | Protestant Reformation (16th c.) | Religious wars, cuius regio | Sovereignty and conscience |
79
+ | English Civil War (1642-1651) | Parliamentary sovereignty | Constitutionalism vs. absolutism |
80
+ | French Revolution (1789) | Popular sovereignty, rights of man | Democratic revolution template |
81
+ | 1848 Revolutions | Liberal nationalism, class conflict | Limits of liberal revolution |
82
+ | Welfare state (20th c.) | Social rights, managed capitalism | State-market-society bargain |
83
+
84
+ ### The French Revolution: Anatomy of Political Struggle
85
+
86
+ ```
87
+ Phases of revolutionary escalation:
88
+
89
+ 1. FISCAL CRISIS (1787-1789)
90
+ - State bankruptcy from war debts
91
+ - Estates-General convened (first since 1614)
92
+ - Third Estate declares National Assembly
93
+
94
+ 2. LIBERAL REVOLUTION (1789-1791)
95
+ - Declaration of the Rights of Man
96
+ - Constitutional monarchy
97
+ - Abolition of feudal privileges
98
+
99
+ 3. RADICALIZATION (1792-1794)
100
+ - War with Austria and Prussia
101
+ - Republic declared, king executed
102
+ - Committee of Public Safety, Terror
103
+ - Factional struggle: Girondins vs. Jacobins vs. sans-culottes
104
+
105
+ 4. THERMIDORIAN REACTION (1794-1799)
106
+ - Fall of Robespierre
107
+ - Conservative republic (Directory)
108
+ - Military coup by Napoleon (1799)
109
+
110
+ ANALYTICAL TAKEAWAYS:
111
+ - Revolutions rarely achieve their initial goals
112
+ - Radicalization driven by external war + internal factional competition
113
+ - "Revolutionary devouring its children" pattern
114
+ - Fiscal crisis as trigger, but ideology shapes trajectory
115
+ ```
116
+
117
+ ## Comparative Analysis
118
+
119
+ ### Divergence in State Formation
120
+
121
+ ```
122
+ Why did China centralize early while Europe remained fragmented?
123
+
124
+ CHINESE CENTRALIZATION:
125
+ - Geographic: North China Plain enabled large-scale agriculture and armies
126
+ - Ideological: Mandate of Heaven legitimized universal rule
127
+ - Administrative: Examination system created loyalist bureaucracy
128
+ - Economic: State monopolies (salt, iron) funded centralization
129
+
130
+ EUROPEAN FRAGMENTATION:
131
+ - Geographic: Mountains, seas, rivers created defensible boundaries
132
+ - Ideological: Church vs. state dual authority
133
+ - Administrative: Feudal loyalties vs. centralized bureaucracy
134
+ - Economic: Commercial city-states resisted centralization
135
+
136
+ COMPARATIVE INSIGHT:
137
+ Neither path is "superior" -- each produced distinctive political capacities:
138
+ - China: Administrative efficiency, cultural unity, but brittle to dynastic collapse
139
+ - Europe: Innovation through competition, but chronic warfare and instability
140
+ ```
141
+
142
+ ### Comparative Methods
143
+
144
+ | Method | Description | Example |
145
+ |--------|-------------|---------|
146
+ | Mill's Method of Difference | Same outcome, different conditions | Why revolution in France but not England? |
147
+ | Mill's Method of Agreement | Different contexts, same outcome | Revolutions in France, Russia, China |
148
+ | Process tracing | Causal mechanisms within a case | How fiscal crisis led to revolution |
149
+ | Path dependence | Early choices constrain later options | Examination system locks in bureaucratic model |
150
+ | Critical junctures | Moments of structural contingency | 1911: Qing collapse opens multiple paths |
151
+ | Counterfactual analysis | "What if" reasoning | What if Wang Anshi reforms had succeeded? |
152
+
153
+ ### Comparative Political Concepts
154
+
155
+ ```
156
+ Concepts that translate across traditions (with caution):
157
+
158
+ LEGITIMACY
159
+ - Chinese: Mandate of Heaven (tianming 天命) -- cosmic-moral authority
160
+ - European: Social contract -- consent of the governed
161
+ - Both: Performance-based (good governance sustains legitimacy)
162
+ - Divergence: Hereditary vs. meritocratic principles
163
+
164
+ BUREAUCRACY
165
+ - Chinese: Scholar-officials selected by examination
166
+ - European: Patrimonial officeholders → Weberian rational bureaucracy
167
+ - Both: Tension between expertise and political loyalty
168
+ - Key difference: China 1000+ years earlier
169
+
170
+ POLITICAL OPPOSITION
171
+ - Chinese: Remonstrance (jian 谏) -- loyal criticism within the system
172
+ - European: Institutionalized opposition (parliament, parties)
173
+ - Both: Risk of punishment for dissent
174
+ - Key difference: Legitimate organized opposition vs. individual moral courage
175
+
176
+ REVOLUTION
177
+ - Chinese: Dynastic cycle (geming 革命 = change of mandate)
178
+ - European: Progressive transformation (revolution as social rupture)
179
+ - Both: Violence as mechanism of political change
180
+ - Key difference: Cyclical vs. linear models of change
181
+ ```
182
+
183
+ ## Research Methods for Political History
184
+
185
+ ### Archival Sources for Political History
186
+
187
+ ```
188
+ Chinese political history sources:
189
+ - Veritable Records (shilu 实录): Official court records
190
+ - Standard Histories (zhengshi 正史): 24 dynastic histories
191
+ - Memorials (zouzhe 奏折): Official communications to the emperor
192
+ - Local gazetteers (difangzhi 地方志): Provincial/county records
193
+ - Private collections (wenji 文集): Literati writings and correspondence
194
+
195
+ European political history sources:
196
+ - Parliamentary records (Hansard, Archives parlementaires)
197
+ - Diplomatic correspondence (state papers, foreign office files)
198
+ - Police and intelligence reports
199
+ - Pamphlets and political press
200
+ - Personal papers of political actors
201
+ - Constitutional and legal documents
202
+ ```
203
+
204
+ ## Writing Comparative Political History
205
+
206
+ ```
207
+ Structure for a comparative article:
208
+
209
+ 1. INTRODUCTION: Present the comparison and why it matters
210
+ 2. THEORETICAL FRAMEWORK: State your analytical categories
211
+ 3. CASE 1: Detailed analysis (e.g., Chinese reform)
212
+ 4. CASE 2: Detailed analysis (e.g., European reform)
213
+ 5. COMPARATIVE ANALYSIS: Systematic comparison
214
+ - Similarities explained
215
+ - Differences explained
216
+ - Theoretical implications
217
+ 6. CONCLUSION: What does the comparison teach us?
218
+
219
+ Common pitfalls:
220
+ - Treating one case as the "norm" and the other as "deviant"
221
+ - Superficial comparison (listing similarities without analysis)
222
+ - Ignoring the internal diversity within each case
223
+ - Anachronism: applying modern concepts to pre-modern societies
224
+ ```
225
+
226
+ ## Best Practices
227
+
228
+ - **Learn the languages.** Serious comparative work requires reading sources in the original.
229
+ - **Avoid teleology.** Do not explain the past as inevitably leading to the present.
230
+ - **Historicize your categories.** "State," "class," "revolution" meant different things in different times and places.
231
+ - **Engage with area studies scholarship.** Comparativists must respect the depth of specialist knowledge.
232
+ - **Be explicit about your units of comparison.** What exactly is being compared, and at what level?
233
+ - **Acknowledge asymmetries.** Chinese and European archives have different biases, gaps, and preservation histories.
234
+
235
+ ## References
236
+
237
+ - Skocpol, T. (1979). States and Social Revolutions. Cambridge UP.
238
+ - Tilly, C. (1992). Coercion, Capital, and European States. Wiley-Blackwell.
239
+ - Zhao, D. (2015). The Confucian-Legalist State: A New Theory of Chinese History. Oxford UP.
240
+ - Fukuyama, F. (2011). The Origins of Political Order. Farrar, Straus and Giroux.
241
+ - [Cambridge History of China](https://www.cambridge.org/core/series/cambridge-history-of-china/) -- Standard reference
@@ -0,0 +1,236 @@
1
+ ---
2
+ name: legal-nlp-guide
3
+ description: "NLP techniques for legal text analysis, case law mining, and contracts"
4
+ metadata:
5
+ openclaw:
6
+ emoji: "balance-scale"
7
+ category: "domains"
8
+ subcategory: "law"
9
+ keywords: ["legal-nlp", "text-mining", "case-law", "contract-analysis", "named-entity", "classification"]
10
+ source: "wentor"
11
+ ---
12
+
13
+ # Legal NLP Guide
14
+
15
+ A skill for applying natural language processing techniques to legal texts. Covers legal document classification, named entity recognition for legal entities, contract clause extraction, case law similarity search, and court opinion summarization using modern NLP tools.
16
+
17
+ ## Legal Text Characteristics
18
+
19
+ Legal language presents unique NLP challenges:
20
+
21
+ - **Long documents**: Court opinions average 5,000-20,000 tokens; contracts can exceed 50,000
22
+ - **Domain-specific vocabulary**: Terms of art with precise legal meanings (e.g., "consideration", "estoppel")
23
+ - **Complex syntax**: Multi-clause sentences with nested qualifications and cross-references
24
+ - **Citation networks**: Dense cross-referencing between cases, statutes, and regulations
25
+ - **Temporal reasoning**: Effective dates, amendments, and retroactivity
26
+
27
+ ## Legal Text Classification
28
+
29
+ ### Document Type Classification
30
+
31
+ ```python
32
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
33
+ import torch
34
+
35
+ # Legal-BERT: domain-adapted BERT for legal text
36
+ model_name = "nlpaueb/legal-bert-base-uncased"
37
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
38
+ model = AutoModelForSequenceClassification.from_pretrained(
39
+ model_name, num_labels=5
40
+ )
41
+
42
+ # Legal document categories
43
+ labels = ["contract", "court_opinion", "statute", "regulation", "brief"]
44
+
45
+ def classify_legal_document(text: str, max_length: int = 512) -> dict:
46
+ """
47
+ Classify a legal document into predefined categories.
48
+ For long documents, use the first 512 tokens (typically the
49
+ preamble/introduction which contains strong classification signals).
50
+ """
51
+ inputs = tokenizer(
52
+ text, return_tensors="pt",
53
+ max_length=max_length, truncation=True, padding=True
54
+ )
55
+ with torch.no_grad():
56
+ logits = model(**inputs).logits
57
+ probs = torch.softmax(logits, dim=-1).squeeze()
58
+ predicted = labels[probs.argmax().item()]
59
+ return {
60
+ "predicted_class": predicted,
61
+ "confidence": probs.max().item(),
62
+ "all_scores": {l: p.item() for l, p in zip(labels, probs)},
63
+ }
64
+ ```
65
+
66
+ ### Topic Classification for Case Law
67
+
68
+ Common topic taxonomies for legal research:
69
+
70
+ | Category | Examples |
71
+ |----------|---------|
72
+ | Constitutional Law | Due process, equal protection, First Amendment |
73
+ | Criminal Law | Sentencing, evidence, plea bargaining |
74
+ | Contract Law | Breach, formation, damages |
75
+ | Tort Law | Negligence, product liability, defamation |
76
+ | Property Law | Real property, intellectual property, zoning |
77
+ | Administrative Law | Agency rulemaking, judicial review |
78
+
79
+ ## Named Entity Recognition
80
+
81
+ ### Legal NER Categories
82
+
83
+ Legal NER extends standard NER with domain-specific entity types:
84
+
85
+ ```python
86
+ import spacy
87
+
88
+ # Load a legal NER model (e.g., trained on the LegalNERo dataset)
89
+ # or fine-tune spaCy on legal annotations
90
+ nlp = spacy.load("en_legal_ner")
91
+
92
+ legal_entity_types = {
93
+ "COURT": "Court or tribunal name",
94
+ "JUDGE": "Judge or justice name",
95
+ "PARTY": "Plaintiff, defendant, petitioner, respondent",
96
+ "STATUTE": "Statute or regulation citation",
97
+ "CASE_CITATION": "Case name and reporter citation",
98
+ "DATE": "Dates of decisions, filings, events",
99
+ "JURISDICTION": "Geographic or subject matter jurisdiction",
100
+ "PROVISION": "Specific section or clause reference",
101
+ }
102
+
103
+ def extract_legal_entities(text: str) -> list[dict]:
104
+ """Extract legal named entities from text."""
105
+ doc = nlp(text)
106
+ entities = []
107
+ for ent in doc.ents:
108
+ entities.append({
109
+ "text": ent.text,
110
+ "label": ent.label_,
111
+ "start": ent.start_char,
112
+ "end": ent.end_char,
113
+ "description": legal_entity_types.get(ent.label_, ""),
114
+ })
115
+ return entities
116
+ ```
117
+
118
+ ### Citation Extraction and Parsing
119
+
120
+ ```python
121
+ import re
122
+
123
+ # US case citation patterns (simplified)
124
+ CASE_CITE_PATTERN = re.compile(
125
+ r"(?P<volume>\d+)\s+"
126
+ r"(?P<reporter>U\.S\.|S\.\s?Ct\.|F\.\s?\d[dthsr]+|"
127
+ r"F\.\s?Supp\.\s?\d*[dthsr]*)\s+"
128
+ r"(?P<page>\d+)"
129
+ r"(?:\s*,\s*(?P<pinpoint>\d+))?"
130
+ r"(?:\s*\((?P<year>\d{4})\))?"
131
+ )
132
+
133
+ def parse_citations(text: str) -> list[dict]:
134
+ """Extract and parse legal citations from text."""
135
+ citations = []
136
+ for match in CASE_CITE_PATTERN.finditer(text):
137
+ citations.append({
138
+ "full_match": match.group(),
139
+ "volume": match.group("volume"),
140
+ "reporter": match.group("reporter"),
141
+ "page": match.group("page"),
142
+ "pinpoint": match.group("pinpoint"),
143
+ "year": match.group("year"),
144
+ })
145
+ return citations
146
+ ```
147
+
148
+ ## Contract Analysis
149
+
150
+ ### Clause Extraction and Classification
151
+
152
+ ```python
153
+ def segment_contract_clauses(text: str) -> list[dict]:
154
+ """
155
+ Segment a contract into numbered clauses and classify them.
156
+ Uses section numbering patterns as primary segmentation cues.
157
+ """
158
+ # Split on section/article numbering patterns
159
+ section_pattern = re.compile(
160
+ r"\n\s*(?:Section|Article|Clause|\d+\.)\s+\d+[\.\d]*\s*[:\.\-]?\s*",
161
+ re.IGNORECASE,
162
+ )
163
+ sections = section_pattern.split(text)
164
+ headers = section_pattern.findall(text)
165
+
166
+ clause_types = {
167
+ "indemnification": ["indemnif", "hold harmless", "defend and indemnify"],
168
+ "termination": ["terminat", "cancel", "expir"],
169
+ "confidentiality": ["confidential", "non-disclosure", "proprietary"],
170
+ "limitation_of_liability": ["limit of liabilit", "limitation of liabilit",
171
+ "aggregate liability", "consequential damages"],
172
+ "governing_law": ["governing law", "governed by", "jurisdiction"],
173
+ "force_majeure": ["force majeure", "act of god", "beyond reasonable control"],
174
+ "assignment": ["assign", "transfer", "delegate"],
175
+ }
176
+
177
+ clauses = []
178
+ for i, section in enumerate(sections[1:], 1):
179
+ detected_type = "general"
180
+ section_lower = section.lower()
181
+ for ctype, keywords in clause_types.items():
182
+ if any(kw in section_lower for kw in keywords):
183
+ detected_type = ctype
184
+ break
185
+ clauses.append({
186
+ "index": i,
187
+ "header": headers[i - 1].strip() if i <= len(headers) else "",
188
+ "type": detected_type,
189
+ "text": section.strip()[:500],
190
+ })
191
+ return clauses
192
+ ```
193
+
194
+ ## Case Similarity and Legal Search
195
+
196
+ ### Embedding-Based Case Retrieval
197
+
198
+ ```python
199
+ from sentence_transformers import SentenceTransformer
200
+ import numpy as np
201
+
202
+ # Legal domain sentence embeddings
203
+ encoder = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2")
204
+
205
+ def build_case_index(case_summaries: list[str]) -> np.ndarray:
206
+ """Encode case summaries into dense vector representations."""
207
+ embeddings = encoder.encode(case_summaries, show_progress_bar=True)
208
+ # L2 normalize for cosine similarity via dot product
209
+ norms = np.linalg.norm(embeddings, axis=1, keepdims=True)
210
+ return embeddings / norms
211
+
212
+ def search_similar_cases(query: str, index: np.ndarray,
213
+ case_ids: list[str], top_k: int = 10) -> list:
214
+ """Find the most similar cases to a query."""
215
+ query_vec = encoder.encode([query])
216
+ query_vec = query_vec / np.linalg.norm(query_vec)
217
+ scores = (index @ query_vec.T).squeeze()
218
+ top_indices = np.argsort(scores)[::-1][:top_k]
219
+ return [(case_ids[i], scores[i]) for i in top_indices]
220
+ ```
221
+
222
+ ## Legal Datasets and Benchmarks
223
+
224
+ - **CaseHOLD**: Multiple-choice QA from case law holdings (Harvard)
225
+ - **LEDGAR**: 100,000 contract provisions labeled with 12 clause types
226
+ - **ECtHR dataset**: European Court of Human Rights case texts with violation labels
227
+ - **LegalBench**: Multi-task benchmark for legal reasoning (Stanford)
228
+ - **CUAD (Contract Understanding Atticus Dataset)**: 510 contracts with 41 clause type annotations
229
+
230
+ ## Tools and Resources
231
+
232
+ - **Legal-BERT / CaseLaw-BERT**: Domain-adapted transformer models
233
+ - **spaCy + Blackstone**: Legal NER and text processing for UK law
234
+ - **Haystack**: Open-source framework for legal document search and QA
235
+ - **CourtListener / RECAP**: Free US case law and PACER document archive
236
+ - **LexNLP (ContraxSuite)**: Python library for legal text extraction