Skip to content

Commit 4f33245

Browse files
authored
docs: switch theme for better readability (#296)
switch the theme used for docs to use the full screen width. Improves readability. Fix a couple of doc issues.
1 parent 03fa3ed commit 4f33245

File tree

6 files changed

+74
-53
lines changed

6 files changed

+74
-53
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
run: |
4747
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
4848
python -m pip install -r python/requirements.txt
49-
python -m pip install sphinx breathe
49+
python -m pip install sphinx breathe sphinx-wagtail-theme
5050
5151
- name: build python extension
5252
run: |

python/description.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ index.Set('key', '{"answer": 42, "condition": "always"}')
1818
index.Flush()
1919
# get the entry for key
2020
m = index.Get('key')
21-
print(m.GetValue())
21+
print(m.value)
2222
2323
# match fuzzy(levenshtein distance) with max edit distance 1, exact prefix 2
24-
m = index.GetFuzzy("kei", 1, 2)
25-
print(m.GetMatchedString())
24+
matches = index.GetFuzzy("kei", 1, 2)
25+
print([m.matched_string for m in matches])
2626
```
2727

28-
For more information visit http://keyvi.org
28+
For more information visit the [docs](https://keyvidev.github.io/keyvi/index.html) and [project](http://keyvi.org) pages.

python/src/pxds/dictionary.pxd

Lines changed: 42 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ cdef extern from "keyvi/dictionary/dictionary.h" namespace "keyvi::dictionary":
2222

2323
cdef cppclass Dictionary:
2424
# wrap-doc:
25-
# Keyvi dictionary, basically a set of key values. Keyvi dictionaries
26-
# are immutable containers, created by a previours compile run.
27-
# Immutability has performance benefits. If you are looking for an
28-
# updateable container, have a look at keyvi index.
25+
# Keyvi dictionary, an immutable containers storing key value pairs, optimized
26+
# for size, lookup performance and special lookp use cases.
27+
# A keyvi dictionary has to be created by a previous compile run.
2928
#
3029
# Keyvi dictionaries allow multiple types of approximate and completion
3130
# matches due to its internal FST based data structure.
@@ -40,57 +39,63 @@ cdef extern from "keyvi/dictionary/dictionary.h" namespace "keyvi::dictionary":
4039
_MatchIteratorPair GetFuzzy (libcpp_utf8_string key, int32_t max_edit_distance, size_t minimum_exact_prefix) except + # wrap-as:match_fuzzy
4140
_MatchIteratorPair GetPrefixCompletion (libcpp_utf8_string key) except + # wrap-as:complete_prefix
4241
# wrap-doc:
43-
# complete the given key to full matches by matching the given key as
44-
# prefix. In case the used dictionary supports inner weights, the
45-
# completer traverses the dictionary according to weights. If weights
46-
# are not available the dictionary gets traversed in byte-order.
42+
# Complete the given key to full matches(prefix matching)
43+
# In case the used dictionary supports inner weights, the
44+
# completer traverses the dictionary according to weights,
45+
# otherwise byte-order.
46+
4747
_MatchIteratorPair GetPrefixCompletion (libcpp_utf8_string key, size_t top_n) except + # wrap-as:complete_prefix
4848
# wrap-doc:
49-
# complete the given key to full matches by matching the given key as
50-
# prefix. This version of prefix completions ensure the return of the
51-
# top name completions. Due to depth-first traversal the traverser
49+
# Complete the given key to full matches(prefix matching)
50+
# and return the top n completions.
51+
# In case the used dictionary supports inner weights, the
52+
# completer traverses the dictionary according to weights,
53+
# otherwise byte-order.
54+
#
55+
# Note, due to depth-first traversal the traverser
5256
# immediately yields results when it visits them. The results are
5357
# neither in order nor limited to n. It is up to the caller to resort
5458
# and truncate the lists of results.
5559
# Only the number of top completions is guaranteed.
60+
5661
_MatchIteratorPair GetMultiwordCompletion (libcpp_utf8_string key) except + # wrap-as:complete_multiword
5762
# wrap-doc:
58-
# complete the given key to full matches by matching the given key as
59-
# multiword. The key can consist of multiple tokens separated by space.
60-
# For matching it gets tokenized put back together bag-of-words style.
61-
# The dictionary must be created the same way.
63+
# Complete the given key to full matches after whitespace tokenizing.
6264
# In case the used dictionary supports inner weights, the
63-
# completer traverses the dictionary according to weights. If weights
64-
# are not available the dictionary gets traversed in byte-order.
65+
# completer traverses the dictionary according to weights,
66+
# otherwise byte-order.
67+
6568
_MatchIteratorPair GetMultiwordCompletion (libcpp_utf8_string key, size_t top_n) except + # wrap-as:complete_multiword
6669
# wrap-doc:
67-
# complete the given key to full matches by matching the given key as
68-
# multiword. The key can consist of multiple tokens separated by space.
69-
# For matching it gets tokenized put back together bag-of-words style.
70-
# The dictionary must be created the same way.
70+
# Complete the given key to full matches after whitespace tokenizing
71+
# and return the top n completions.
7172
# In case the used dictionary supports inner weights, the
72-
# completer traverses the dictionary according to weights. If weights
73-
# are not available the dictionary gets traversed in byte-order.
73+
# completer traverses the dictionary according to weights,
74+
# otherwise byte-order.
75+
#
76+
# Note, due to depth-first traversal the traverser
77+
# immediately yields results when it visits them. The results are
78+
# neither in order nor limited to n. It is up to the caller to resort
79+
# and truncate the lists of results.
80+
# Only the number of top completions is guaranteed.
81+
7482
_MatchIteratorPair GetFuzzyMultiwordCompletion (libcpp_utf8_string key, int32_t max_edit_distance) except + # wrap-as:complete_fuzzy_multiword
7583
# wrap-doc:
76-
# complete the given key to full matches by matching the given key as
77-
# multiword allowing up to max_edit_distance distance(Levenshtein).
78-
# The key can consist of multiple tokens separated by space.
79-
# For matching it gets tokenized put back together bag-of-words style.
80-
# The dictionary must be created the same way.
84+
# Complete the given key to full matches after whitespace tokenizing,
85+
# allowing up to max_edit_distance distance(Levenshtein).
8186
# In case the used dictionary supports inner weights, the
82-
# completer traverses the dictionary according to weights. If weights
83-
# are not available the dictionary gets traversed in byte-order.
87+
# completer traverses the dictionary according to weights,
88+
# otherwise byte-order.
89+
8490
_MatchIteratorPair GetFuzzyMultiwordCompletion (libcpp_utf8_string key, int32_t max_edit_distance, size_t minimum_exact_prefix) except + # wrap-as:complete_fuzzy_multiword
8591
# wrap-doc:
86-
# complete the given key to full matches by matching the given key as
87-
# multiword allowing up to max_edit_distance distance(Levenshtein).
88-
# The key can consist of multiple tokens separated by space.
89-
# For matching it gets tokenized put back together bag-of-words style.
90-
# The dictionary must be created the same way.
92+
# Complete the given key to full matches after whitespace tokenizing,
93+
# allowing up to max_edit_distance distance(Levenshtein) except for
94+
# a given exaxt prefix which must match exaxt.
9195
# In case the used dictionary supports inner weights, the
92-
# completer traverses the dictionary according to weights. If weights
93-
# are not available the dictionary gets traversed in byte-order.
96+
# completer traverses the dictionary according to weights,
97+
# otherwise byte-order.
98+
9499
_MatchIteratorPair GetAllItems () # wrap-ignore
95100
_MatchIteratorPair Lookup(libcpp_utf8_string key) # wrap-as:search
96101
_MatchIteratorPair LookupText(libcpp_utf8_string text) # wrap-as:search_tokenized

sphinx-docs/_static/custom.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.bg-primary {
2+
background-color: #7dc466 !important;
3+
}
4+
5+
/* Code snippets. */
6+
pre {
7+
background-color: #24292f;
8+
}

sphinx-docs/_static/logo-white.png

29.1 KB
Loading

sphinx-docs/conf_extra.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
1-
from os.path import join, dirname, abspath
2-
import alabaster
1+
from os.path import join, dirname
2+
import sphinx_wagtail_theme
33

4-
html_theme = "alabaster"
4+
html_theme = "sphinx_wagtail_theme"
5+
html_theme_path = [sphinx_wagtail_theme.get_html_theme_path()]
56

67
html_static_path = [join(dirname(__file__), "_static")]
78

8-
html_theme_options = {
9-
"logo": "logo.png",
10-
"logo_name": True,
11-
"logo_text_align": "center",
12-
"github_user": "keyvidev",
13-
"github_repo": "keyvi",
14-
"github_type": "star"
15-
}
9+
html_theme_options = dict(
10+
project_name= "keyvi",
11+
logo= "logo-white.png",
12+
logo_alt = "keyvi",
13+
github_url = "https://github.com/KeyviDev/keyvi/tree/master/sphinx-docs/",
14+
footer_links = ",".join([
15+
"Github|https://github.com/KeyviDev/keyvi",
16+
"Pypi|https://pypi.org/project/keyvi/",
17+
]),
18+
)
19+
20+
html_show_copyright = False
21+
html_last_updated_fmt = "%b %d, %Y"
22+
23+
html_css_files = ["custom.css"]

0 commit comments

Comments
 (0)