Skip to content

Commit 52bebba

Browse files
1 parent ef62dac commit 52bebba

131 files changed

Lines changed: 4103 additions & 4586 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: dab1459ff459300ab718386f1443def5
3+
config: 78769fedddad905ff51511eb2d382de2
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

_modules/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<head>
66
<meta charset="utf-8" />
77
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
8-
<title>Overview: module code &mdash; PyThaiNLP 9dfae5a documentation</title>
8+
<title>Overview: module code &mdash; PyThaiNLP 0207d40 documentation</title>
99
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=03e43079" />
1010
<link rel="stylesheet" type="text/css" href="../_static/css/theme.css?v=9edc463e" />
1111
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
@@ -14,7 +14,7 @@
1414

1515
<script src="../_static/jquery.js?v=5d32c60e"></script>
1616
<script src="../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
17-
<script src="../_static/documentation_options.js?v=8559df46"></script>
17+
<script src="../_static/documentation_options.js?v=ec1a47bb"></script>
1818
<script src="../_static/doctools.js?v=fd6eb6e6"></script>
1919
<script src="../_static/sphinx_highlight.js?v=6ffebe34"></script>
2020
<script src="../_static/clipboard.min.js?v=a7894cd8"></script>

_modules/pythainlp/ancient/aksonhan.html

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<head>
66
<meta charset="utf-8" />
77
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
8-
<title>pythainlp.ancient.aksonhan &mdash; PyThaiNLP 9dfae5a documentation</title>
8+
<title>pythainlp.ancient.aksonhan &mdash; PyThaiNLP 0207d40 documentation</title>
99
<link rel="stylesheet" type="text/css" href="../../../_static/pygments.css?v=03e43079" />
1010
<link rel="stylesheet" type="text/css" href="../../../_static/css/theme.css?v=9edc463e" />
1111
<link rel="stylesheet" type="text/css" href="../../../_static/copybutton.css?v=76b2166b" />
@@ -14,7 +14,7 @@
1414

1515
<script src="../../../_static/jquery.js?v=5d32c60e"></script>
1616
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
17-
<script src="../../../_static/documentation_options.js?v=8559df46"></script>
17+
<script src="../../../_static/documentation_options.js?v=ec1a47bb"></script>
1818
<script src="../../../_static/doctools.js?v=fd6eb6e6"></script>
1919
<script src="../../../_static/sphinx_highlight.js?v=6ffebe34"></script>
2020
<script src="../../../_static/clipboard.min.js?v=a7894cd8"></script>
@@ -144,28 +144,24 @@ <h1>Source code for pythainlp.ancient.aksonhan</h1><div class="highlight"><pre>
144144
<span class="k">def</span><span class="w"> </span><span class="nf">aksonhan_to_current</span><span class="p">(</span><span class="n">word</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
145145
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Convert AksonHan words to current Thai words</span>
146146

147-
<span class="sd"> AksonHan (อักษรหัน) writes down two consonants for the \</span>
148-
<span class="sd"> spelling of the /a/ vowels. (สระ อะ).</span>
147+
<span class="sd"> AksonHan (อักษรหัน) writes two consonants to spell</span>
148+
<span class="sd"> the short /a/ vowel (สระ อะ).</span>
149149

150-
<span class="sd"> Today, รร is an aksonHan word that is still used in Thai.</span>
150+
<span class="sd"> Today, รร is an aksonhan pattern still used in Thai.</span>
151151

152152
<span class="sd"> :param str word: Thai word</span>
153153
<span class="sd"> :return: Thai AksonHan to be converted to current Thai word</span>
154154
<span class="sd"> :rtype: str</span>
155155

156156
<span class="sd"> :Example:</span>
157-
<span class="sd"> ::</span>
158157

159-
<span class="sd"> from pythainlp.ancient import aksonhan_to_current</span>
160-
161-
<span class="sd"> print(aksonhan_to_current(&quot;จกก&quot;))</span>
162-
<span class="sd"> # output: จัก</span>
163-
164-
<span class="sd"> print(aksonhan_to_current(&quot;บงงคบบ&quot;))</span>
165-
<span class="sd"> # output: บังคับ</span>
166-
167-
<span class="sd"> print(aksonhan_to_current(&quot;สรรเพชญ&quot;)) # รร is still used.</span>
168-
<span class="sd"> # output: สรรเพชญ</span>
158+
<span class="sd"> &gt;&gt;&gt; from pythainlp.ancient import aksonhan_to_current</span>
159+
<span class="sd"> &gt;&gt;&gt; print(aksonhan_to_current(&quot;จกก&quot;))</span>
160+
<span class="sd"> จัก</span>
161+
<span class="sd"> &gt;&gt;&gt; print(aksonhan_to_current(&quot;บงงคบบ&quot;))</span>
162+
<span class="sd"> บังคับ</span>
163+
<span class="sd"> &gt;&gt;&gt; print(aksonhan_to_current(&quot;สรรเพชญ&quot;)) # รร is still used.</span>
164+
<span class="sd"> สรรเพชญ</span>
169165

170166
<span class="sd"> &quot;&quot;&quot;</span>
171167
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">word</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">3</span><span class="p">:</span>

_modules/pythainlp/ancient/currency.html

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<head>
66
<meta charset="utf-8" />
77
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
8-
<title>pythainlp.ancient.currency &mdash; PyThaiNLP 9dfae5a documentation</title>
8+
<title>pythainlp.ancient.currency &mdash; PyThaiNLP 0207d40 documentation</title>
99
<link rel="stylesheet" type="text/css" href="../../../_static/pygments.css?v=03e43079" />
1010
<link rel="stylesheet" type="text/css" href="../../../_static/css/theme.css?v=9edc463e" />
1111
<link rel="stylesheet" type="text/css" href="../../../_static/copybutton.css?v=76b2166b" />
@@ -14,7 +14,7 @@
1414

1515
<script src="../../../_static/jquery.js?v=5d32c60e"></script>
1616
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
17-
<script src="../../../_static/documentation_options.js?v=8559df46"></script>
17+
<script src="../../../_static/documentation_options.js?v=ec1a47bb"></script>
1818
<script src="../../../_static/doctools.js?v=fd6eb6e6"></script>
1919
<script src="../../../_static/sphinx_highlight.js?v=6ffebe34"></script>
2020
<script src="../../../_static/clipboard.min.js?v=a7894cd8"></script>
@@ -141,22 +141,10 @@ <h1>Source code for pythainlp.ancient.currency</h1><div class="highlight"><pre>
141141
<span class="sd"> :rtype: dict[str, float]</span>
142142

143143
<span class="sd"> :Example:</span>
144-
<span class="sd"> ::</span>
145-
146-
<span class="sd"> from pythainlp.ancient import convert_currency</span>
147-
148-
<span class="sd"> print(convert_currency(8, &quot;บาท&quot;))</span>
149-
<span class="sd"> # output:</span>
150-
<span class="sd"> # {</span>
151-
<span class="sd"> # &#39;เบี้ย&#39;: 51200.0,</span>
152-
<span class="sd"> # &#39;อัฐ&#39;: 512.0,</span>
153-
<span class="sd"> # &#39;ไพ&#39;: 256.0,</span>
154-
<span class="sd"> # &#39;เฟื้อง&#39;: 64.0,</span>
155-
<span class="sd"> # &#39;สลึง&#39;: 32.0,</span>
156-
<span class="sd"> # &#39;บาท&#39;: 8.0,</span>
157-
<span class="sd"> # &#39;ตำลึง&#39;: 2.0,</span>
158-
<span class="sd"> # &#39;ชั่ง&#39;: 0.1</span>
159-
<span class="sd"> # }</span>
144+
145+
<span class="sd"> &gt;&gt;&gt; from pythainlp.ancient import convert_currency</span>
146+
<span class="sd"> &gt;&gt;&gt; print(convert_currency(8, &quot;บาท&quot;))</span>
147+
<span class="sd"> {&#39;เบี้ย&#39;: 51200.0, &#39;อัฐ&#39;: 512.0, &#39;ไพ&#39;: 256.0, &#39;เฟื้อง&#39;: 64.0, &#39;สลึง&#39;: 32.0, &#39;บาท&#39;: 8.0, &#39;ตำลึง&#39;: 2.0, &#39;ชั่ง&#39;: 0.1}</span>
160148

161149
<span class="sd"> &quot;&quot;&quot;</span>
162150
<span class="n">conversion_factors_to_att</span> <span class="o">=</span> <span class="p">{</span>
@@ -172,7 +160,7 @@ <h1>Source code for pythainlp.ancient.currency</h1><div class="highlight"><pre>
172160

173161
<span class="k">if</span> <span class="n">from_unit</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">conversion_factors_to_att</span><span class="p">:</span>
174162
<span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span>
175-
<span class="sa">f</span><span class="s2">&quot;Currency unit &#39;</span><span class="si">{</span><span class="n">from_unit</span><span class="si">}</span><span class="s2">&#39; is not support.&quot;</span>
163+
<span class="sa">f</span><span class="s2">&quot;Currency unit &#39;</span><span class="si">{</span><span class="n">from_unit</span><span class="si">}</span><span class="s2">&#39; is not supported.&quot;</span>
176164
<span class="p">)</span>
177165

178166
<span class="c1"># start from &#39;อัฐ&#39;</span>

_modules/pythainlp/benchmarks/metrics.html

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<head>
66
<meta charset="utf-8" />
77
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
8-
<title>pythainlp.benchmarks.metrics &mdash; PyThaiNLP 9dfae5a documentation</title>
8+
<title>pythainlp.benchmarks.metrics &mdash; PyThaiNLP 0207d40 documentation</title>
99
<link rel="stylesheet" type="text/css" href="../../../_static/pygments.css?v=03e43079" />
1010
<link rel="stylesheet" type="text/css" href="../../../_static/css/theme.css?v=9edc463e" />
1111
<link rel="stylesheet" type="text/css" href="../../../_static/copybutton.css?v=76b2166b" />
@@ -14,7 +14,7 @@
1414

1515
<script src="../../../_static/jquery.js?v=5d32c60e"></script>
1616
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
17-
<script src="../../../_static/documentation_options.js?v=8559df46"></script>
17+
<script src="../../../_static/documentation_options.js?v=ec1a47bb"></script>
1818
<script src="../../../_static/doctools.js?v=fd6eb6e6"></script>
1919
<script src="../../../_static/sphinx_highlight.js?v=6ffebe34"></script>
2020
<script src="../../../_static/clipboard.min.js?v=a7894cd8"></script>
@@ -246,24 +246,22 @@ <h1>Source code for pythainlp.benchmarks.metrics</h1><div class="highlight"><pre
246246
<span class="sd"> :rtype: BleuScore</span>
247247

248248
<span class="sd"> :Example:</span>
249-
<span class="sd"> ::</span>
250249

251-
<span class="sd"> from pythainlp.benchmarks import bleu_score</span>
252-
253-
<span class="sd"> references = [&quot;สวัสดีครับ วันนี้อากาศดีมาก&quot;]</span>
254-
<span class="sd"> hypotheses = [&quot;สวัสดีค่ะ วันนี้อากาศดี&quot;]</span>
255-
<span class="sd"> score = bleu_score(references, hypotheses)</span>
256-
<span class="sd"> print(f&quot;BLEU score: {score[&#39;bleu&#39;]:.2f}&quot;)</span>
257-
258-
<span class="sd"> ::</span>
259-
260-
<span class="sd"> # Multiple references per hypothesis</span>
261-
<span class="sd"> references = [</span>
262-
<span class="sd"> [&quot;สวัสดีครับ&quot;, &quot;สวัสดีค่ะ&quot;], # two refs for first hypothesis</span>
263-
<span class="sd"> [&quot;ลาก่อนครับ&quot;, &quot;ลาก่อนค่ะ&quot;], # two refs for second hypothesis</span>
264-
<span class="sd"> ]</span>
265-
<span class="sd"> hypotheses = [&quot;สวัสดี&quot;, &quot;ลาก่อน&quot;]</span>
266-
<span class="sd"> score = bleu_score(references, hypotheses)</span>
250+
<span class="sd"> &gt;&gt;&gt; from pythainlp.benchmarks import bleu_score</span>
251+
252+
<span class="sd"> &gt;&gt;&gt; references = [&quot;สวัสดีครับ วันนี้อากาศดีมาก&quot;]</span>
253+
<span class="sd"> &gt;&gt;&gt; hypotheses = [&quot;สวัสดีค่ะ วันนี้อากาศดี&quot;]</span>
254+
<span class="sd"> &gt;&gt;&gt; score = bleu_score(references, hypotheses)</span>
255+
<span class="sd"> &gt;&gt;&gt; print(f&quot;BLEU score: {score[&#39;bleu&#39;]:.2f}&quot;)</span>
256+
<span class="sd"> BLEU score: 28.12</span>
257+
258+
<span class="sd"> &gt;&gt;&gt; # Multiple references per hypothesis</span>
259+
<span class="sd"> &gt;&gt;&gt; references = [</span>
260+
<span class="sd"> ... [&quot;สวัสดีครับ&quot;, &quot;สวัสดีค่ะ&quot;], # two refs for first hypothesis</span>
261+
<span class="sd"> ... [&quot;ลาก่อนครับ&quot;, &quot;ลาก่อนค่ะ&quot;], # two refs for second hypothesis</span>
262+
<span class="sd"> ... ]</span>
263+
<span class="sd"> &gt;&gt;&gt; hypotheses = [&quot;สวัสดี&quot;, &quot;ลาก่อน&quot;]</span>
264+
<span class="sd"> &gt;&gt;&gt; score = bleu_score(references, hypotheses)</span>
267265
<span class="sd"> &quot;&quot;&quot;</span>
268266
<span class="kn">from</span><span class="w"> </span><span class="nn">pythainlp.tokenize</span><span class="w"> </span><span class="kn">import</span> <span class="n">word_tokenize</span>
269267

@@ -400,16 +398,18 @@ <h1>Source code for pythainlp.benchmarks.metrics</h1><div class="highlight"><pre
400398
<span class="sd"> :rtype: dict[str, RougeScore]</span>
401399

402400
<span class="sd"> :Example:</span>
403-
<span class="sd"> ::</span>
404-
405-
<span class="sd"> from pythainlp.benchmarks import rouge_score</span>
406401

407-
<span class="sd"> reference = &quot;สวัสดีครับ วันนี้อากาศดีมาก&quot;</span>
408-
<span class="sd"> hypothesis = &quot;สวัสดีค่ะ วันนี้อากาศดี&quot;</span>
409-
<span class="sd"> scores = rouge_score(reference, hypothesis)</span>
410-
<span class="sd"> print(f&quot;ROUGE-1 F-measure: {scores[&#39;rouge1&#39;][&#39;fmeasure&#39;]:.4f}&quot;)</span>
411-
<span class="sd"> print(f&quot;ROUGE-2 F-measure: {scores[&#39;rouge2&#39;][&#39;fmeasure&#39;]:.4f}&quot;)</span>
412-
<span class="sd"> print(f&quot;ROUGE-L F-measure: {scores[&#39;rougeL&#39;][&#39;fmeasure&#39;]:.4f}&quot;)</span>
402+
<span class="sd"> &gt;&gt;&gt; from pythainlp.benchmarks import rouge_score</span>
403+
404+
<span class="sd"> &gt;&gt;&gt; reference = &quot;สวัสดีครับ วันนี้อากาศดีมาก&quot;</span>
405+
<span class="sd"> &gt;&gt;&gt; hypothesis = &quot;สวัสดีค่ะ วันนี้อากาศดี&quot;</span>
406+
<span class="sd"> &gt;&gt;&gt; scores = rouge_score(reference, hypothesis)</span>
407+
<span class="sd"> &gt;&gt;&gt; print(f&quot;ROUGE-1 F-measure: {scores[&#39;rouge1&#39;][&#39;fmeasure&#39;]:.4f}&quot;)</span>
408+
<span class="sd"> ROUGE-1 F-measure: 0.6000</span>
409+
<span class="sd"> &gt;&gt;&gt; print(f&quot;ROUGE-2 F-measure: {scores[&#39;rouge2&#39;][&#39;fmeasure&#39;]:.4f}&quot;)</span>
410+
<span class="sd"> ROUGE-2 F-measure: 0.2500</span>
411+
<span class="sd"> &gt;&gt;&gt; print(f&quot;ROUGE-L F-measure: {scores[&#39;rougeL&#39;][&#39;fmeasure&#39;]:.4f}&quot;)</span>
412+
<span class="sd"> ROUGE-L F-measure: 0.6000</span>
413413
<span class="sd"> &quot;&quot;&quot;</span>
414414
<span class="kn">from</span><span class="w"> </span><span class="nn">pythainlp.tokenize</span><span class="w"> </span><span class="kn">import</span> <span class="n">word_tokenize</span>
415415

@@ -512,14 +512,14 @@ <h1>Source code for pythainlp.benchmarks.metrics</h1><div class="highlight"><pre
512512
<span class="sd"> :rtype: float</span>
513513

514514
<span class="sd"> :Example:</span>
515-
<span class="sd"> ::</span>
516515

517-
<span class="sd"> from pythainlp.benchmarks import word_error_rate</span>
516+
<span class="sd"> &gt;&gt;&gt; from pythainlp.benchmarks import word_error_rate</span>
518517

519-
<span class="sd"> reference = &quot;สวัสดีครับ วันนี้อากาศดีมาก&quot;</span>
520-
<span class="sd"> hypothesis = &quot;สวัสดีค่ะ วันนี้อากาศดี&quot;</span>
521-
<span class="sd"> wer = word_error_rate(reference, hypothesis)</span>
522-
<span class="sd"> print(f&quot;WER: {wer:.4f}&quot;)</span>
518+
<span class="sd"> &gt;&gt;&gt; reference = &quot;สวัสดีครับ วันนี้อากาศดีมาก&quot;</span>
519+
<span class="sd"> &gt;&gt;&gt; hypothesis = &quot;สวัสดีค่ะ วันนี้อากาศดี&quot;</span>
520+
<span class="sd"> &gt;&gt;&gt; wer = word_error_rate(reference, hypothesis)</span>
521+
<span class="sd"> &gt;&gt;&gt; print(f&quot;WER: {wer:.4f}&quot;)</span>
522+
<span class="sd"> WER: 0.4000</span>
523523
<span class="sd"> &quot;&quot;&quot;</span>
524524
<span class="kn">from</span><span class="w"> </span><span class="nn">pythainlp.tokenize</span><span class="w"> </span><span class="kn">import</span> <span class="n">word_tokenize</span>
525525

@@ -593,14 +593,14 @@ <h1>Source code for pythainlp.benchmarks.metrics</h1><div class="highlight"><pre
593593
<span class="sd"> :rtype: float</span>
594594

595595
<span class="sd"> :Example:</span>
596-
<span class="sd"> ::</span>
597596

598-
<span class="sd"> from pythainlp.benchmarks import character_error_rate</span>
597+
<span class="sd"> &gt;&gt;&gt; from pythainlp.benchmarks import character_error_rate</span>
599598

600-
<span class="sd"> reference = &quot;สวัสดีครับ&quot;</span>
601-
<span class="sd"> hypothesis = &quot;สวัสดีค่ะ&quot;</span>
602-
<span class="sd"> cer = character_error_rate(reference, hypothesis)</span>
603-
<span class="sd"> print(f&quot;CER: {cer:.4f}&quot;)</span>
599+
<span class="sd"> &gt;&gt;&gt; reference = &quot;สวัสดีครับ&quot;</span>
600+
<span class="sd"> &gt;&gt;&gt; hypothesis = &quot;สวัสดีค่ะ&quot;</span>
601+
<span class="sd"> &gt;&gt;&gt; cer = character_error_rate(reference, hypothesis)</span>
602+
<span class="sd"> &gt;&gt;&gt; print(f&quot;CER: {cer:.4f}&quot;)</span>
603+
<span class="sd"> CER: 0.3000</span>
604604
<span class="sd"> &quot;&quot;&quot;</span>
605605
<span class="c1"># Work with characters directly (no tokenization needed)</span>
606606
<span class="n">ref_chars</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">reference</span><span class="p">)</span>

0 commit comments

Comments
 (0)