From 7badbc30dba59806323ba416dd6f336a861c482a Mon Sep 17 00:00:00 2001
From: Kaelyn Ferris <43348706+kaelynj@users.noreply.github.com>
Date: Fri, 23 Feb 2024 11:02:11 -0500
Subject: [PATCH] Reconfigure cspell to use dictionaries (#873)
Closes #827
---
README.md | 4 +-
cSpell.json | 285 ---------------------------------
cspell/cSpell.json | 57 +++++++
cspell/dictionaries/people.txt | 88 ++++++++++
cspell/dictionaries/qiskit.txt | 159 ++++++++++++++++++
package.json | 2 +-
6 files changed, 307 insertions(+), 288 deletions(-)
delete mode 100644 cSpell.json
create mode 100644 cspell/cSpell.json
create mode 100644 cspell/dictionaries/people.txt
create mode 100644 cspell/dictionaries/qiskit.txt
diff --git a/README.md b/README.md
index 3eea5b5231..9f742fcd34 100644
--- a/README.md
+++ b/README.md
@@ -243,9 +243,9 @@ There are two ways to deal with cSpell incorrectly complaining about a word, suc
Ayyyyy, this is a fake description.
```
-2. Add the word to the file `cSpell.json` in the `words` section. The word is not case-sensitive.
+2. If the word is a name, add it to the `cspell/dictionaries/people.txt` file. If it is a scientific or quantum specific word, add it to the `cspell/dictionaries/qiskit.txt` file. If it doesn't fit in either category, add it to the `words` section in `cspell/cSpell.json`. The word is not case-sensitive.
-If the word appears in multiple files, prefer the second approach to add it to `cSpell.json`.
+If the word appears in multiple files, prefer the second approach to add it to one of the dictionaries or `cSpell.json`.
## Check that pages render
diff --git a/cSpell.json b/cSpell.json
deleted file mode 100644
index d27b29ac30..0000000000
--- a/cSpell.json
+++ /dev/null
@@ -1,285 +0,0 @@
-// This file is copied from IBM's closed source configuration. When updating it
-// here, also update the closed source repository, or ask a maintainer to do so
-// if you do not have access.
-{
- "version": "0.2",
- "language": "en",
- "allowCompoundWords": true,
- "words": [
- "Aaronson",
- "Ahokas",
- "Abelian",
- "Abhari",
- "Almaden",
- "Alon",
- "Ambainis",
- "Ansatz",
- "anticommute",
- "anticommutes",
- "arccos",
- "arcsin",
- "arctan",
- "argsort",
- "arity",
- "autodifferentiation",
- "ancillae",
- "ancillas",
- "ansatzes",
- "bijective",
- "Boeblingen",
- "Bravyi",
- "Bremner",
- "Bruhat",
- "Bures",
- "Canonicalization",
- "Capelluto",
- "Chebyshev",
- "Choi",
- "Chong",
- "CHSH",
- "Chuang",
- "qubit",
- "qubits",
- "Qiskit",
- "qasm",
- "Hamiltonians",
- "Eigensolver",
- "Eigensolvers",
- "EPLG",
- "Factorizers",
- "exponentials",
- "Hadamard",
- "matplotlib",
- "numpy",
- "Kraus",
- "unitaries",
- "decomp",
- "Paulis",
- "Cleve",
- "Trotterization",
- "Trotterizations",
- "Solovay",
- "Kitaev",
- "Cliffords",
- "connectivities",
- "Cuccaro",
- "destabilizer",
- "detuning",
- "Dueck",
- "Easwar",
- "eigenstate",
- "eigenstates",
- "Eisert",
- "equispaced",
- "fermionic",
- "Frobenius",
- "Gosset",
- "Gottesman",
- "Gushu",
- "Häner",
- "Hardamard",
- "Havlicek",
- "Hein",
- "Hiptmair",
- "Hoare",
- "Hoyer",
- "initialised",
- "initialiser",
- "ints",
- "Ipython",
- "ipywidgets",
- "Ising",
- "Iten",
- "Itoko",
- "Javadi",
- "Jurcevic",
- "Ketan",
- "Koenig",
- "Kolkata",
- "Kutin",
- "Lauer",
- "Margolus",
- "Martonosi",
- "Maslov",
- "Merkel",
- "Mølmer",
- "Moscas",
- "Motzoi",
- "Moyard",
- "multinomial",
- "multiqubit",
- "Murali",
- "Nannicini",
- "Nesterov’s",
- "Neumann",
- "openqasm",
- "Ourense",
- "parameterizing",
- "Paulihedral",
- "polynomially",
- "Poppler",
- "Prakash",
- "pygments",
- "pyplot",
- "Raban",
- "Rebentrost",
- "Renato",
- "Renner",
- "rescheduler",
- "resynthesized",
- "Roetteler",
- "Rueschlikon",
- "satisfiability",
- "schedulable",
- "Shaohan",
- "Shaydulin",
- "Shende",
- "Shor’s",
- "Simonetto",
- "Smolin",
- "Sørensen",
- "struct",
- "structs",
- "Sutter",
- "Svore",
- "Symegine",
- "symplectic",
- "tensored",
- "Theor",
- "Toffoli",
- "uncompiled",
- "uncompute",
- "uncomputed",
- "unentanglement",
- "unnormalized",
- "Unroller",
- "Vazirani",
- "Vedral",
- "venv",
- "Watrous",
- "Weyl",
- "Woerner",
- "Yufei",
- "Zoufal",
- "Mosca",
- "pydot",
- "qudit",
- "qutrit",
- "Uhrig",
- "saveas",
- "Tapp",
- "extremal",
- "Anharmonicity",
- "ALAP",
- "atol",
- "ASPLOS",
- "BFGS",
- "CDKM",
- "CNOT",
- "stddev",
- "expval",
- "qsphere",
- "cargs",
- "cbit",
- "cbits",
- "opflow",
- "qobj",
- "ibmq",
- "clbit",
- "Clbits",
- "cmap",
- "cnots",
- "coeff",
- "coeffs",
- "CPLEX",
- "CPTP",
- "creg",
- "cregs",
- "csdg",
- "CSWAP",
- "CVXPY",
- "DIMACS",
- "docplex",
- "dtype",
- "Fieldr",
- "fsim",
- "kwarg",
- "kwargs",
- "kwparams",
- "lnot",
- "mathbb",
- "nqubits",
- "paulivec",
- "qarg",
- "qargs",
- "qreg",
- "qregs",
- "regs",
- "xgate",
- "basicaer",
- "basicaererror",
- "cregbundle",
- "iqft",
- "iswap",
- "MCMT",
- "MCMTV",
- "ndarray",
- "NISQ",
- "nxpd",
- "oper",
- "PRNG",
- "QAOA",
- "rcccx",
- "RCCX",
- "repr",
- "rtol",
- "rustworkx",
- "sched",
- "sxdg",
- "srepr",
- "sympy",
- "TOQM",
- "uchannel",
- "UCRX",
- "UCRY",
- "UCRZ",
- "XIYY",
- "ZSXX",
- "qelib",
- "QVSM",
- "ITTL",
- "QRTE",
- "mathrm",
- "exponentiated",
- "simulable",
- "resynthesizes",
- "sdist"
- ],
- "ignoreRegExpList": [
- // Markdown links
- "\\((.*)\\)",
- // markdown code blocks. https://github.com/streetsidesoftware/vscode-spell-checker/issues/202#issuecomment-377477473
- "/^\\s*```[\\s\\S]*?^\\s*```/gm",
- // inline code blocks. https://stackoverflow.com/questions/41274241/how-to-capture-inline-markdown-code-but-not-a-markdown-code-fence-with-regex
- "\\`([^\\`].*?)\\`",
- // $$ ... $$ code blocks
- "\\$\\$\n(?:.*\n)*?\\$\\$",
- // markdown metadata block. e.g. title, description, etc.
- "---\n(?:.*\n)*?---",
- // words inside curly braces. e.g. {word}
- "{\\w+}",
- // words inside colons. e.g. :word:
- ":\\S+:",
- // words joined by underscores. e.g. hello_world, NEW_KEY_VALUE
- "\\S+_\\S+(_\\S+)*",
- // separate line tags
- "^$",
- "^$"
- ],
- "ignorePaths": [
- // We cannot easily control these API docs since they live in other repositories.
- "docs/api/qiskit/**/*.md*",
- "docs/api/qiskit-ibm-runtime/**/*.md*",
- "docs/api/qiskit-ibm-provider/**/*.md*"
- ]
-}
diff --git a/cspell/cSpell.json b/cspell/cSpell.json
new file mode 100644
index 0000000000..dc986c3bd4
--- /dev/null
+++ b/cspell/cSpell.json
@@ -0,0 +1,57 @@
+// This file is copied from IBM's closed source configuration. When updating it
+// here, also update the closed source repository, or ask a maintainer to do so
+// if you do not have access.
+{
+ "version": "0.2",
+ "language": "en",
+ "allowCompoundWords": true,
+ "dictionaryDefinitions": [
+ {
+ "name": "qiskit",
+ "path": "dictionaries/qiskit.txt",
+ "addWords": true
+ },
+ {
+ "name": "people",
+ "path": "dictionaries/people.txt",
+ "addWords": true
+ }
+ ],
+ "dictionaries": [
+ "qiskit",
+ "people",
+ "python",
+ "python-common",
+ "markdown",
+ "softwareTerms",
+ "scientific-terms-us"
+ ],
+ "words": ["Qiskit", "qiskit"],
+ "ignoreRegExpList": [
+ // Markdown links
+ "\\((.*)\\)",
+ // markdown code blocks. https://github.com/streetsidesoftware/vscode-spell-checker/issues/202#issuecomment-377477473
+ "/^\\s*```[\\s\\S]*?^\\s*```/gm",
+ // inline code blocks. https://stackoverflow.com/questions/41274241/how-to-capture-inline-markdown-code-but-not-a-markdown-code-fence-with-regex
+ "\\`([^\\`].*?)\\`",
+ // $$ ... $$ code blocks
+ "\\$\\$\n(?:.*\n)*?\\$\\$",
+ // markdown metadata block. e.g. title, description, etc.
+ "---\n(?:.*\n)*?---",
+ // words inside curly braces. e.g. {word}
+ "{\\w+}",
+ // words inside colons. e.g. :word:
+ ":\\S+:",
+ // words joined by underscores. e.g. hello_world, NEW_KEY_VALUE
+ "\\S+_\\S+(_\\S+)*",
+ // separate line tags
+ "^$",
+ "^$"
+ ],
+ "ignorePaths": [
+ // We cannot easily control these API docs since they live in other repositories.
+ "../docs/api/qiskit/**/*.md*",
+ "../docs/api/qiskit-ibm-runtime/**/*.md*",
+ "../docs/api/qiskit-ibm-provider/**/*.md*"
+ ]
+}
diff --git a/cspell/dictionaries/people.txt b/cspell/dictionaries/people.txt
new file mode 100644
index 0000000000..dd1e1495c8
--- /dev/null
+++ b/cspell/dictionaries/people.txt
@@ -0,0 +1,88 @@
+Aaronson
+Ahokas
+Abelian
+Abhari
+Almaden
+Alon
+Ambainis
+Boeblingen
+Bravyi
+Bremner
+Bruhat
+Bures
+Capelluto
+Chebyshev
+Choi
+Chong
+Chuang
+Kraus
+Paulis
+Solovay
+Kitaev
+Cleve
+Cuccaro
+Dueck
+Easwar
+Eisert
+Frobenius
+Gosset
+Gottesman
+Gushu
+Häner
+Hardamard
+Havlicek
+Hein
+Hiptmair
+Hoare
+Hoyer
+Ising
+Iten
+Itoko
+Javadi
+Jurcevic
+Ketan
+Koenig
+Kolkata
+Kutin
+Lauer
+Margolus
+Martonosi
+Maslov
+Merkel
+Mølmer
+Moscas
+Motzoi
+Moyard
+Murali
+Nannicini
+Nesterov’s
+Neumann
+Ourense
+Poppler
+Prakash
+Raban
+Rebentrost
+Renato
+Renner
+Roetteler
+Rueschlikon
+Shaohan
+Shaydulin
+Shende
+Shor’s
+Simonetto
+Smolin
+Sørensen
+Sutter
+Svore
+Toffoli
+Vazirani
+Vedral
+Watrous
+Weyl
+Woerner
+Yufei
+Zoufal
+Mosca
+Uhrig
+Tapp
diff --git a/cspell/dictionaries/qiskit.txt b/cspell/dictionaries/qiskit.txt
new file mode 100644
index 0000000000..bd3bee7a49
--- /dev/null
+++ b/cspell/dictionaries/qiskit.txt
@@ -0,0 +1,159 @@
+Abelian
+Ansatz
+anticommute
+anticommutes
+arccos
+arcsin
+arctan
+argsort
+autodifferentiation
+ancillae
+ancillas
+ansatzes
+bijective
+Canonicalization
+CHSH
+qubit
+qubits
+Qiskit
+qasm
+Hamiltonians
+Eigensolver
+Eigensolvers
+EPLG
+Factorizers
+exponentials
+Hadamard
+matplotlib
+numpy
+unitaries
+decomp
+Trotterization
+Trotterizations
+Cliffords
+connectivities
+destabilizer
+detuning
+eigenstate
+eigenstates
+equispaced
+fermionic
+initialised
+initialiser
+ints
+Ipython
+ipywidgets
+multinomial
+multiqubit
+openqasm
+parameterizing
+Paulihedral
+polynomially
+pygments
+pyplot
+rescheduler
+resynthesized
+satisfiability
+schedulable
+struct
+structs
+Symegine
+symplectic
+tensored
+uncompiled
+uncompute
+uncomputed
+unentanglement
+unnormalized
+Unroller
+venv
+pydot
+qudit
+qutrit
+saveas
+extremal
+Anharmonicity
+ALAP
+atol
+ASPLOS
+BFGS
+CDKM
+CNOT
+stddev
+expval
+qsphere
+cargs
+cbit
+cbits
+opflow
+qobj
+ibmq
+clbit
+Clbits
+cmap
+cnots
+coeff
+coeffs
+CPLEX
+CPTP
+creg
+cregs
+csdg
+CSWAP
+CVXPY
+DIMACS
+docplex
+dtype
+Fieldr
+fsim
+kwarg
+kwargs
+kwparams
+lnot
+mathbb
+nqubits
+paulivec
+qarg
+qargs
+qreg
+qregs
+regs
+xgate
+basicaer
+basicaererror
+cregbundle
+iqft
+iswap
+MCMT
+MCMTV
+ndarray
+NISQ
+nxpd
+oper
+PRNG
+QAOA
+rcccx
+RCCX
+repr
+rtol
+rustworkx
+sched
+sxdg
+srepr
+sympy
+TOQM
+uchannel
+UCRX
+UCRY
+UCRZ
+XIYY
+ZSXX
+qelib
+QVSM
+ITTL
+QRTE
+mathrm
+exponentiated
+simulable
+resynthesizes
+sdist"
diff --git a/package.json b/package.json
index 8c91ca30b9..ad66f94f4c 100644
--- a/package.json
+++ b/package.json
@@ -8,7 +8,7 @@
"check": "npm run check:metadata && npm run check:spelling && npm run check:links && npm run check:fmt",
"check:metadata": "node -r esbuild-register scripts/commands/checkMetadata.ts",
"check:links": "node -r esbuild-register scripts/commands/checkLinks.ts",
- "check:spelling": "cspell --relative --no-progress docs/**/*.md* docs/api/**/*.md*",
+ "check:spelling": "cspell --relative --no-progress docs/**/*.md* docs/api/**/*.md* --config cspell/cSpell.json",
"check:fmt": "prettier --check .",
"check-pages-render": "node -r esbuild-register scripts/commands/checkPagesRender.ts",
"fmt": "prettier --write .",