diff --git a/_modules/index.html b/_modules/index.html index 95e6a27..b44b554 100644 --- a/_modules/index.html +++ b/_modules/index.html @@ -1,10 +1,10 @@ - + - + Overview: module code - spacy-wrap 1.4.4 documentation @@ -255,9 +255,9 @@

All modules for which code is available

- + - + diff --git a/_modules/spacy_wrap/pipeline_component_seq_clf.html b/_modules/spacy_wrap/pipeline_component_seq_clf.html index 122aacc..d2c1887 100644 --- a/_modules/spacy_wrap/pipeline_component_seq_clf.html +++ b/_modules/spacy_wrap/pipeline_component_seq_clf.html @@ -1,10 +1,10 @@ - + - + spacy_wrap.pipeline_component_seq_clf - spacy-wrap 1.4.4 documentation @@ -530,7 +530,9 @@

Source code for spacy_wrap.pipeline_component_seq_clf

return doc -
[docs]@Language.factory( +
+[docs] +@Language.factory( "sequence_classification_transformer", default_config=DEFAULT_CONFIG["sequence_classification_transformer"], ) @@ -609,6 +611,7 @@

Source code for spacy_wrap.pipeline_component_seq_clf

assign_to_cats=assign_to_cats, ) return clf_trf
+
@@ -648,9 +651,9 @@

Source code for spacy_wrap.pipeline_component_seq_clf

+
- + diff --git a/_modules/spacy_wrap/pipeline_component_tok_clf.html b/_modules/spacy_wrap/pipeline_component_tok_clf.html index 91181c6..5d88216 100644 --- a/_modules/spacy_wrap/pipeline_component_tok_clf.html +++ b/_modules/spacy_wrap/pipeline_component_tok_clf.html @@ -1,10 +1,10 @@ - + - + spacy_wrap.pipeline_component_tok_clf - spacy-wrap 1.4.4 documentation @@ -635,7 +635,9 @@

Source code for spacy_wrap.pipeline_component_tok_clf

return doc -
[docs]@Language.factory( +
+[docs] +@Language.factory( "token_classification_transformer", default_config=DEFAULT_CONFIG["token_classification_transformer"], ) @@ -721,6 +723,7 @@

Source code for spacy_wrap.pipeline_component_tok_clf

predictions_to=predictions_to, ) return clf_trf
+
@@ -760,9 +763,9 @@

Source code for spacy_wrap.pipeline_component_tok_clf

+
- + diff --git a/_static/basic.css b/_static/basic.css index cfc60b8..30fee9d 100644 --- a/_static/basic.css +++ b/_static/basic.css @@ -237,6 +237,10 @@ a.headerlink { visibility: hidden; } +a:visited { + color: #551A8B; +} + h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, diff --git a/_static/documentation_options.js b/_static/documentation_options.js index 23cf86b..b88f210 100644 --- a/_static/documentation_options.js +++ b/_static/documentation_options.js @@ -1,5 +1,4 @@ -var DOCUMENTATION_OPTIONS = { - URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), +const DOCUMENTATION_OPTIONS = { VERSION: '1.4.4', LANGUAGE: 'en', COLLAPSE_INDEX: false, diff --git a/_static/searchtools.js b/_static/searchtools.js index 97d56a7..7918c3f 100644 --- a/_static/searchtools.js +++ b/_static/searchtools.js @@ -57,12 +57,12 @@ const _removeChildren = (element) => { const _escapeRegExp = (string) => string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string -const _displayItem = (item, searchTerms) => { +const _displayItem = (item, searchTerms, highlightTerms) => { const docBuilder = DOCUMENTATION_OPTIONS.BUILDER; - const docUrlRoot = DOCUMENTATION_OPTIONS.URL_ROOT; const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX; const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX; const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY; + const contentRoot = document.documentElement.dataset.content_root; const [docName, title, anchor, descr, score, _filename] = item; @@ -75,20 +75,24 @@ const _displayItem = (item, searchTerms) => { if (dirname.match(/\/index\/$/)) dirname = dirname.substring(0, dirname.length - 6); else if (dirname === "index/") dirname = ""; - requestUrl = docUrlRoot + dirname; + requestUrl = contentRoot + dirname; linkUrl = requestUrl; } else { // normal html builders - requestUrl = docUrlRoot + docName + docFileSuffix; + requestUrl = contentRoot + docName + docFileSuffix; linkUrl = docName + docLinkSuffix; } let linkEl = listItem.appendChild(document.createElement("a")); linkEl.href = linkUrl + anchor; linkEl.dataset.score = score; linkEl.innerHTML = title; - if (descr) + if (descr) { listItem.appendChild(document.createElement("span")).innerHTML = " (" + descr + ")"; + // highlight search terms in the description + if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js + highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); + } else if (showSearchSummary) fetch(requestUrl) .then((responseData) => responseData.text()) @@ -97,6 +101,9 @@ const _displayItem = (item, searchTerms) => { listItem.appendChild( Search.makeSearchSummary(data, searchTerms) ); + // highlight search terms in the summary + if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js + highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); }); Search.output.appendChild(listItem); }; @@ -115,14 +122,15 @@ const _finishSearch = (resultCount) => { const _displayNextItem = ( results, resultCount, - searchTerms + searchTerms, + highlightTerms, ) => { // results left, load the summary and display it // this is intended to be dynamic (don't sub resultsCount) if (results.length) { - _displayItem(results.pop(), searchTerms); + _displayItem(results.pop(), searchTerms, highlightTerms); setTimeout( - () => _displayNextItem(results, resultCount, searchTerms), + () => _displayNextItem(results, resultCount, searchTerms, highlightTerms), 5 ); } @@ -360,7 +368,7 @@ const Search = { // console.info("search results:", Search.lastresults); // print the results - _displayNextItem(results, results.length, searchTerms); + _displayNextItem(results, results.length, searchTerms, highlightTerms); }, /** diff --git a/_static/sphinx_highlight.js b/_static/sphinx_highlight.js index aae669d..8a96c69 100644 --- a/_static/sphinx_highlight.js +++ b/_static/sphinx_highlight.js @@ -29,14 +29,19 @@ const _highlight = (node, addItems, text, className) => { } span.appendChild(document.createTextNode(val.substr(pos, text.length))); + const rest = document.createTextNode(val.substr(pos + text.length)); parent.insertBefore( span, parent.insertBefore( - document.createTextNode(val.substr(pos + text.length)), + rest, node.nextSibling ) ); node.nodeValue = val.substr(0, pos); + /* There may be more occurrences of search term in this node. So call this + * function recursively on the remaining fragment. + */ + _highlight(rest, addItems, text, className); if (isInSVG) { const rect = document.createElementNS( @@ -140,5 +145,10 @@ const SphinxHighlight = { }, }; -_ready(SphinxHighlight.highlightSearchWords); -_ready(SphinxHighlight.initEscapeListener); +_ready(() => { + /* Do not call highlightSearchWords() when we are on the search page. + * It will highlight words from the *previous* search query. + */ + if (typeof Search === "undefined") SphinxHighlight.highlightSearchWords(); + SphinxHighlight.initEscapeListener(); +}); diff --git a/faq.html b/faq.html index b3b43cf..377c6ba 100644 --- a/faq.html +++ b/faq.html @@ -1,5 +1,5 @@ - + @@ -16,7 +16,7 @@ - + Frequently asked questions - spacy-wrap 1.4.4 documentation @@ -235,9 +235,9 @@
-

Frequently asked questions#

+

Frequently asked questions#

-

Citing spacy-wrap#

+

Citing spacy-wrap#

If you wish this library in your research, please cite it using (Changing the version if relevant):

@software{Enevoldsen_spaCy-wrap_For_Wrapping_2022,
    author = {Enevoldsen, Kenneth},
@@ -256,7 +256,7 @@ 

Citing spacy-wrap -

How do I test the code and run the test suite?#

+

How do I test the code and run the test suite?#

This package comes with an extensive test suite. In order to run the tests, you’ll usually want to clone the repository and build the package from the source. This will also install the required development dependencies @@ -276,7 +276,7 @@

How do I test the code and run the test suite? -

Does this package run on X?#

+

Does this package run on X?#

This package is intended to run on all major OS, this includes Windows (latest version), MacOS (latest) and the latest version of Linux (Ubuntu). Similarly it also tested on python 3.8, and 3.9. Please note these are only the systems this package is being actively tested on, if you run on a similar system (e.g. an earlier version of Linux) this package @@ -284,7 +284,7 @@

Does this package run on X? -

How is the documentation generated?#

+

How is the documentation generated?#

SpaCy-wrap uses sphinx to generate documentation. It uses the Furo theme with custom styling.

@@ -372,9 +372,9 @@

How is the documentation generated? +

- + diff --git a/genindex.html b/genindex.html index 6279826..9c5cc95 100644 --- a/genindex.html +++ b/genindex.html @@ -1,10 +1,10 @@ - + - Index - spacy-wrap 1.4.4 documentation + Index - spacy-wrap 1.4.4 documentation @@ -270,9 +270,9 @@

M

-
+ - + diff --git a/index.html b/index.html index 082d196..20e333f 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,5 @@ - + @@ -16,7 +16,7 @@ - + spacy-wrap 1.4.4 documentation @@ -235,14 +235,14 @@
-

SpaCy-wrap#

+

SpaCy-wrap#

https://img.shields.io/github/stars/kennethenevoldsen/spacy-wrap.svg?style=social&label=Star&maxAge=2592000

spaCy-wrap is minimal library intended for wrapping fine-tuned transformers from the Huggingface model hub in your spaCy pipeline allowing inclusion of existing models within SpaCy workflows.

As for as possible it follows a similar API as spacy-transformers.

-

Where to ask questions?#

+

Where to ask questions?#

To ask report issues or request features, please use the GitHub Issue Tracker. Questions related to SpaCy are kindly referred to the SpaCy GitHub or forum. Otherwise, @@ -270,7 +270,7 @@

Where to ask questions?

-

Acknowledgements#

+

Acknowledgements#

Spacy-wrap modifies pre-existing code from spacy-transformers and thus a large part of the credit goes to the Explosion team. Similarly, the library utilizes models available on the Huggingface Hub, thus wrapped pipelines should be attributed to the respective @@ -286,7 +286,7 @@

Acknowledgements -

Indices and search#

+

Indices and search#