Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to v0.2.0 #5

Merged
merged 1 commit into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed dist/strtree-0.1.0-py3-none-any.whl
Binary file not shown.
Binary file removed dist/strtree-0.1.0.tar.gz
Binary file not shown.
Binary file added dist/strtree-0.2.0-py3-none-any.whl
Binary file not shown.
Binary file added dist/strtree-0.2.0.tar.gz
Binary file not shown.
336 changes: 317 additions & 19 deletions dummy_example.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "strtree"
version = "0.1.2"
version = "0.2.0"
authors = [
{ name="Anton Saroka", email="[email protected]" },
]
Expand Down
91 changes: 68 additions & 23 deletions site/assets/_mkdocstrings.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,39 +26,84 @@
float: right;
}

/* Keep headings consistent. */
h1.doc-heading,
h2.doc-heading,
h3.doc-heading,
h4.doc-heading,
h5.doc-heading,
h6.doc-heading {
font-weight: 400;
line-height: 1.5;
color: inherit;
text-transform: none;
/* Symbols in Navigation and ToC. */
:root,
[data-md-color-scheme="default"] {
--doc-symbol-attribute-fg-color: #953800;
--doc-symbol-function-fg-color: #8250df;
--doc-symbol-method-fg-color: #8250df;
--doc-symbol-class-fg-color: #0550ae;
--doc-symbol-module-fg-color: #5cad0f;

--doc-symbol-attribute-bg-color: #9538001a;
--doc-symbol-function-bg-color: #8250df1a;
--doc-symbol-method-bg-color: #8250df1a;
--doc-symbol-class-bg-color: #0550ae1a;
--doc-symbol-module-bg-color: #5cad0f1a;
}

[data-md-color-scheme="slate"] {
--doc-symbol-attribute-fg-color: #ffa657;
--doc-symbol-function-fg-color: #d2a8ff;
--doc-symbol-method-fg-color: #d2a8ff;
--doc-symbol-class-fg-color: #79c0ff;
--doc-symbol-module-fg-color: #baff79;

--doc-symbol-attribute-bg-color: #ffa6571a;
--doc-symbol-function-bg-color: #d2a8ff1a;
--doc-symbol-method-bg-color: #d2a8ff1a;
--doc-symbol-class-bg-color: #79c0ff1a;
--doc-symbol-module-bg-color: #baff791a;
}

code.doc-symbol {
border-radius: .1rem;
font-size: .85em;
padding: 0 .3em;
font-weight: bold;
}

code.doc-symbol-attribute {
color: var(--doc-symbol-attribute-fg-color);
background-color: var(--doc-symbol-attribute-bg-color);
}

code.doc-symbol-attribute::after {
content: "attr";
}

code.doc-symbol-function {
color: var(--doc-symbol-function-fg-color);
background-color: var(--doc-symbol-function-bg-color);
}

code.doc-symbol-function::after {
content: "func";
}

h1.doc-heading {
font-size: 1.6rem;
code.doc-symbol-method {
color: var(--doc-symbol-method-fg-color);
background-color: var(--doc-symbol-method-bg-color);
}

h2.doc-heading {
font-size: 1.2rem;
code.doc-symbol-method::after {
content: "meth";
}

h3.doc-heading {
font-size: 1.15rem;
code.doc-symbol-class {
color: var(--doc-symbol-class-fg-color);
background-color: var(--doc-symbol-class-bg-color);
}

h4.doc-heading {
font-size: 1.10rem;
code.doc-symbol-class::after {
content: "class";
}

h5.doc-heading {
font-size: 1.05rem;
code.doc-symbol-module {
color: var(--doc-symbol-module-fg-color);
background-color: var(--doc-symbol-module-bg-color);
}

h6.doc-heading {
font-size: 1rem;
code.doc-symbol-module::after {
content: "mod";
}
2 changes: 1 addition & 1 deletion site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -242,5 +242,5 @@ <h4 class="modal-title" id="keyboardModalLabel">Keyboard Shortcuts</h4>

<!--
MkDocs version : 1.5.3
Build Date UTC : 2024-06-26 17:06:08.041925+00:00
Build Date UTC : 2024-06-29 16:57:52.989578+00:00
-->
Binary file modified site/objects.inv
Binary file not shown.
105 changes: 50 additions & 55 deletions site/pattern_reference/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@

<li class="nav-item" data-level="1"><a href="#utils.Pattern" class="nav-link">Pattern</a>
<ul class="nav flex-column">
<li class="nav-item" data-level="2"><a href="#utils.Pattern.filter" class="nav-link">filter()</a>
<li class="nav-item" data-level="2"><a href="#utils.Pattern.filter" class="nav-link">filter</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#utils.Pattern.match" class="nav-link">match()</a>
<li class="nav-item" data-level="2"><a href="#utils.Pattern.match" class="nav-link">match</a>
<ul class="nav flex-column">
</ul>
</li>
<li class="nav-item" data-level="2"><a href="#utils.Pattern.scores" class="nav-link">scores()</a>
<li class="nav-item" data-level="2"><a href="#utils.Pattern.scores" class="nav-link">scores</a>
<ul class="nav flex-column">
</ul>
</li>
Expand All @@ -112,26 +112,27 @@



<h1 class="doc doc-heading" id="utils.Pattern">
<span class="doc doc-object-name doc-class-name">Pattern</span>
<h1 id="utils.Pattern" class="doc doc-heading">
<span class="doc doc-object-name doc-class-name">Pattern</span>


</h1>
<div class="highlight"><pre><span></span><code><span class="n">Pattern</span><span class="p">(</span><span class="n">pattern</span><span class="p">)</span>
<div class="doc-signature highlight"><pre><span></span><code><span class="n">Pattern</span><span class="p">(</span><span class="n">pattern</span><span class="p">)</span>
</code></pre></div>

<div class="doc doc-contents first">


<p>Class for representing a pattern (a regular expression).</p>


<p>Initialize a Pattern.</p>



<p>Parameters:</p>
<ul>
<li class="field-body">
<b>pattern</b>
<b><code>pattern</code></b>
(<code><span title="utils.Pattern.str">str</span> | <a class="autorefs autorefs-internal" title="utils.Pattern" href="#utils.Pattern">Pattern</a></code>)
<div class="doc-md-description">
Expand All @@ -153,70 +154,46 @@ <h1 class="doc doc-heading" id="utils.Pattern">




<div class="doc doc-object doc-function">



<h2 class="doc doc-heading" id="utils.Pattern.filter">
<span class="doc doc-object-name doc-function-name">filter</span>
<h2 id="utils.Pattern.filter" class="doc doc-heading">
<span class="doc doc-object-name doc-function-name">filter</span>


</h2>
<div class="highlight"><pre><span></span><code><span class="nb">filter</span><span class="p">(</span><span class="n">strings</span><span class="p">,</span> <span class="n">labels</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span>
<div class="doc-signature highlight"><pre><span></span><code><span class="nb">filter</span><span class="p">(</span><span class="n">strings</span><span class="p">)</span>
</code></pre></div>

<div class="doc doc-contents ">

<p>Return strings and labels which match the pattern and which don't.</p>
<p>Return a boolean mask for strings matching the pattern.</p>



<p>Parameters:</p>
<ul>
<li class="field-body">
<b>strings</b>
<b><code>strings</code></b>
(<code>list[<span title="utils.Pattern.str">str</span>]</code>)
<div class="doc-md-description">
<p>Strings to filter.</p>
</div>
</li>
<li class="field-body">
<b>labels</b>
(<code>list[int]</code>)
<div class="doc-md-description">
<p>Labels of strings.</p>
</div>
</li>
</ul>



<p>Returns:</p>
<ul>
<li class="field-body">
<code>matched_strings</code>
<div class="doc-md-description">
<p>Strings which match the pattern.</p>
</div>
</li>
<li class="field-body">
<code>labels_of_matched</code>
<code>matches</code>
<div class="doc-md-description">
<p>Labels of strings which match the pattern. If no labels provided, an empty list.</p>
</div>
</li>
<li class="field-body">
<code>not_matched_strings</code>
<div class="doc-md-description">
<p>Strings which don't match the pattern.</p>
</div>
</li>
<li class="field-body">
<code>labels_of_not_matched</code>
<div class="doc-md-description">
<p>Labels of strings which don't match the pattern. If no labels provided, an empty list.</p>
<p>Numpy array of bool type.</p>
</div>
</li>
</ul>
Expand All @@ -225,16 +202,17 @@ <h2 class="doc doc-heading" id="utils.Pattern.filter">

</div>


<div class="doc doc-object doc-function">



<h2 class="doc doc-heading" id="utils.Pattern.match">
<span class="doc doc-object-name doc-function-name">match</span>
<h2 id="utils.Pattern.match" class="doc doc-heading">
<span class="doc doc-object-name doc-function-name">match</span>


</h2>
<div class="highlight"><pre><span></span><code><span class="k">match</span><span class="p">(</span><span class="n">string</span><span class="p">)</span>
<div class="doc-signature highlight"><pre><span></span><code><span class="k">match</span><span class="p">(</span><span class="n">string</span><span class="p">)</span>
</code></pre></div>

<div class="doc doc-contents ">
Expand All @@ -245,50 +223,66 @@ <h2 class="doc doc-heading" id="utils.Pattern.match">

</div>


<div class="doc doc-object doc-function">



<h2 class="doc doc-heading" id="utils.Pattern.scores">
<span class="doc doc-object-name doc-function-name">scores</span>
<h2 id="utils.Pattern.scores" class="doc doc-heading">
<span class="doc doc-object-name doc-function-name">scores</span>


</h2>
<div class="highlight"><pre><span></span><code><span class="n">scores</span><span class="p">(</span><span class="n">strings</span><span class="p">,</span> <span class="n">labels</span><span class="p">)</span>
<div class="doc-signature highlight"><pre><span></span><code><span class="n">scores</span><span class="p">(</span><span class="n">strings</span><span class="p">,</span> <span class="n">labels</span><span class="p">,</span> <span class="n">full_labels_list</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span>
</code></pre></div>

<div class="doc doc-contents ">

<p>Calculate classification quality scores for pattern's matches and the labels.</p>
<p>Pattern's matches are considered as "predictions" when calculating quality metrics.</p>



<p>Parameters:</p>
<ul>
<li class="field-body">
<b>strings</b>
<b><code>strings</code></b>
(<code>list[<span title="utils.Pattern.str">str</span>]</code>)
<div class="doc-md-description">
<p>A list of strings.</p>
</div>
</li>
<li class="field-body">
<b>labels</b>
<b><code>labels</code></b>
(<code>list[int]</code>)
<div class="doc-md-description">
<p>A list of strings labels consisting of 0 and 1.</p>
<p>A list of strings labels.</p>
</div>
</li>
<li class="field-body">
<b><code>full_labels_list</code></b>
(<code>list[int]</code>, default:
<code>None</code>
)
<div class="doc-md-description">
<p>A full list of unique labels that can be present among labels.</p>
</div>
</li>
</ul>



<p>Returns:</p>
<ul>
<li class="field-body">
<b>response</b>( <code>dict</code>
<b><code>response</code></b> ( <code>dict</code>
) –
<div class="doc-md-description">
<p>Contains keys: 'n_strings', 'total_positive', 'n_matches', 'precision', 'recall' and 'accuracy'.</p>
<p>Contains keys: 'n_strings', 'total_positive', 'n_matches', 'precision', 'recall' and 'accuracy'.
If there are more than 2 classes, each key is a list corresponding to each class.</p>
</div>
</li>
</ul>
Expand All @@ -303,6 +297,7 @@ <h2 class="doc doc-heading" id="utils.Pattern.scores">

</div>


</div></div>
</div>
</div>
Expand Down
Loading
Loading