[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-frameworks-devel
Subject:    Re: Review Request 124282: Implement Voikko based spellchecker for Sonnet
From:       "Martin Tobias Holmedahl Sandsmark" <martin.sandsmark () kde ! org>
Date:       2015-07-07 19:11:54
Message-ID: 20150707191154.16549.55118 () mimi ! kde ! org
[Download RAW message or body]

--===============8513581250019642192==
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit



> On July 7, 2015, 7:07 p.m., Martin Tobias Holmedahl Sandsmark wrote:
> > src/plugins/voikko/voikkodict.cpp, line 125
> > <https://git.reviewboard.kde.org/r/124282/diff/3/?file=383592#file383592line125>
> > 
> > if (replacements.contains(word)) {
> > suggestions.append(word);
> > }
> > 
> > is much more readable

I didn't see apol's comment above, but considering that this isn't something that's \
going to be called often and be performance criticial I much prefer your original \
code (much more readable).

Even if my example was wrong (the new version was hard to grok). :-)


- Martin Tobias Holmedahl


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/124282/#review82192
-----------------------------------------------------------


On July 7, 2015, 2:44 p.m., Jesse Jaara wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/124282/
> -----------------------------------------------------------
> 
> (Updated July 7, 2015, 2:44 p.m.)
> 
> 
> Review request for KDE Frameworks and Martin Tobias Holmedahl Sandsmark.
> 
> 
> Repository: sonnet
> 
> 
> Description
> -------
> 
> # Implement Voikko based spellchecker for Sonnet
> 
> ## Description
> Implements a spell chekcing plugin based on libvoikko <http://voikko.puimula.org/>.
> Primarily for supporting highquality Finnishs spell checking, but HFST trancuders
> can be found several other languages too.
> <http://sourceforge.net/projects/hfst/files/resources/spell-transducers/>
> 
> 
> ## List of commits (oldest 1st)
> ---------------------------------------------------------------------------------------------------
>  
> Define QLoggingCategory for for voikko speller plugin
> 
> * Declared SONNET_VOIKKO QLoggingCategory
> 
> --------------------------------------------------------------------------------------------------
>  
> Implement Voikko based spellchecker (dictionary)
> 
> * All Sonnet::SpellerPlugin functions are implemented.
> * storeReplacement() and addToPersonal() use Json based storage.
> * File location:
> * UNIX & OSX: QStandardPaths::GenericDataLocation/Sonnet/Voikko-user-dictionary.json
>                 
> * Windows >= Vista: \
>                 QSP::GenericDataLocation/../Roaming/Sonnet/Voikko-user-dictionary.json
>                 
> * XP: QSP::GenericDataLocation/../../Aplication \
>                 Data/Sonnet/Voikko-user-dictionary.json
> * Format:
> ```JSON
> { "<languageId>": {
> "PersonalWords": [
> "word"
> ],
> "Replacements": [
> {"bad": "eror",
> "good": "error"}
> ]
> }
> ```
> * Before use VoikkoDict based chekkers must be ensured to be with valid with \
> initFailed(). As so the ctor is protected and only accessible from friens class \
> VoikkoClient, which does this check before returning the speller. Using an invalid \
> speller will result in null-pointer exceptions.
> 
> --------------------------------------------------------------------------------------------------
>  
> Implement Sonnet::Client for Voikko speller
> 
> * Reliability set to 50.
> Voikko is primarily only used for Finnish at the moment, although
> the HFST transducer-backend has added support for other languages
> of varying quality.
> As for Finnish (99% of use cases) the results are top quality.
> 
> In any case the reliability should be higher than that of hunspell
> and aspell to prevent them from kicking in for Finnish, as the
> Finnish dictionarys for them are low-quality.
> 
> * Name is "Voikko"
> 
> --------------------------------------------------------------------------------------------------
>  
> Add in CMakeBits needed to compile Voikko speller.
> 
> * Added FindVOIKKO module
> 
> 
> Diffs
> -----
> 
> cmake/FindVOIKKO.cmake PRE-CREATION 
> src/plugins/CMakeLists.txt 3d24d61 
> src/plugins/voikko/CMakeLists.txt PRE-CREATION 
> src/plugins/voikko/voikkoclient.h PRE-CREATION 
> src/plugins/voikko/voikkoclient.cpp PRE-CREATION 
> src/plugins/voikko/voikkodebug.h PRE-CREATION 
> src/plugins/voikko/voikkodebug.cpp PRE-CREATION 
> src/plugins/voikko/voikkodict.h PRE-CREATION 
> src/plugins/voikko/voikkodict.cpp PRE-CREATION 
> 
> Diff: https://git.reviewboard.kde.org/r/124282/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Jesse Jaara
> 
> 


--===============8513581250019642192==
MIME-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 7bit




<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="12" style="border: 1px #c9c399 \
solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">  \
<tr>  <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://git.reviewboard.kde.org/r/124282/">https://git.reviewboard.kde.org/r/124282/</a>
  </td>
    </tr>
   </table>
   <br />










<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On July 7th, 2015, 7:07 p.m. UTC, <b>Martin Tobias \
Holmedahl Sandsmark</b> wrote:</p>  <blockquote style="margin-left: 1em; border-left: \
2px solid #d0d0d0; padding-left: 10px;">  


<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="https://git.reviewboard.kde.org/r/124282/diff/3/?file=383592#file383592line125" \
style="color: black; font-weight: bold; text-decoration: \
underline;">src/plugins/voikko/voikkodict.cpp</a>  <span style="font-weight: \
normal;">

     (Diff revision 3)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">125</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span \
class="n">suggestions</span><span class="p">.</span><span \
class="n">append</span><span class="p">(</span><span class="o">*</span><span \
class="n">userDictPos</span><span class="p">);</span></pre></td>  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">if \
(replacements.contains(word)) {  suggestions.append(word);
    }</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">is much more readable</p></pre>  </blockquote>





</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">I didn't see apol's comment above, but considering that this isn't \
something that's going to be called often and be performance criticial I much prefer \
your original code (much more readable).</p> <p style="padding: 0;text-rendering: \
inherit;margin: 0;line-height: inherit;white-space: inherit;">Even if my example was \
wrong (the new version was hard to grok). :-)</p></pre> <br />




<p>- Martin Tobias Holmedahl</p>


<br />
<p>On July 7th, 2015, 2:44 p.m. UTC, Jesse Jaara wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: \
1px #888a85 solid; border-radius: 6px; -moz-border-radius: 6px; \
-webkit-border-radius: 6px;">  <tr>
  <td>

<div>Review request for KDE Frameworks and Martin Tobias Holmedahl Sandsmark.</div>
<div>By Jesse Jaara.</div>


<p style="color: grey;"><i>Updated July 7, 2015, 2:44 p.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
sonnet
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;"><h1 style="font-size: 100%;text-rendering: inherit;padding: \
0;white-space: normal;margin: 0;line-height: inherit;">Implement Voikko based \
spellchecker for Sonnet</h1> <h2 style="font-size: 100%;text-rendering: \
inherit;padding: 0;white-space: normal;margin: 0;line-height: \
inherit;">Description</h2> <p style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: inherit;">Implements a spell chekcing plugin \
based on libvoikko <a href="http://voikko.puimula.org/" style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
normal;">http://voikko.puimula.org/</a>. Primarily for supporting highquality \
Finnishs spell checking, but HFST trancuders can be found several other languages \
too. <a href="http://sourceforge.net/projects/hfst/files/resources/spell-transducers/" \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
normal;">http://sourceforge.net/projects/hfst/files/resources/spell-transducers/</a></p>
 <h2 style="font-size: 100%;text-rendering: inherit;padding: 0;white-space: \
normal;margin: 0;line-height: inherit;">List of commits (oldest 1st)</h2> <hr \
style="text-rendering: inherit;margin: 0;padding: 0;white-space: normal;border: 1px \
solid #ddd;line-height: inherit;" /> <p style="padding: 0;text-rendering: \
inherit;margin: 0;line-height: inherit;white-space: inherit;">Define QLoggingCategory \
for for voikko speller plugin</p> <ul style="padding: 0;text-rendering: \
inherit;margin: 0 0 0 1em;line-height: inherit;white-space: normal;"> <li \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
normal;">Declared SONNET_VOIKKO QLoggingCategory</li> </ul>
<hr style="text-rendering: inherit;margin: 0;padding: 0;white-space: normal;border: \
1px solid #ddd;line-height: inherit;" /> <p style="padding: 0;text-rendering: \
inherit;margin: 0;line-height: inherit;white-space: inherit;">Implement Voikko based \
spellchecker (dictionary)</p> <ul style="padding: 0;text-rendering: inherit;margin: 0 \
0 0 1em;line-height: inherit;white-space: normal;"> <li style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">All \
Sonnet::SpellerPlugin functions are implemented.</li> <li style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
normal;">storeReplacement() and addToPersonal() use Json based storage.<ul \
style="padding: 0;text-rendering: inherit;margin: 0 0 0 1em;line-height: \
inherit;white-space: normal;"> <li style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: normal;">File location:<ul style="padding: \
0;text-rendering: inherit;margin: 0 0 0 1em;line-height: inherit;white-space: \
normal;"> <li style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: normal;">UNIX &amp; OSX: \
QStandardPaths::GenericDataLocation/Sonnet/Voikko-user-dictionary.json</li> <li \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
normal;">Windows &gt;= Vista: \
QSP::GenericDataLocation/../Roaming/Sonnet/Voikko-user-dictionary.json</li> <li \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
normal;">XP: QSP::GenericDataLocation/../../Aplication \
Data/Sonnet/Voikko-user-dictionary.json</li> </ul>
</li>
<li style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: normal;">Format:</li> </ul>
</li>
</ul>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;"><div class="codehilite" style="background: \
#f8f8f8"><pre style="line-height: 125%">{ <span style="color: #008000; font-weight: \
bold">&quot;&lt;languageId&gt;&quot;</span>: {  <span style="color: #008000; \
font-weight: bold">&quot;PersonalWords&quot;</span>: [  <span style="color: \
#BA2121">&quot;word&quot;</span>  ],
    <span style="color: #008000; font-weight: bold">&quot;Replacements&quot;</span>: \
                [
        {<span style="color: #008000; font-weight: bold">&quot;bad&quot;</span>: \
                <span style="color: #BA2121">&quot;eror&quot;</span>,
         <span style="color: #008000; font-weight: bold">&quot;good&quot;</span>: \
<span style="color: #BA2121">&quot;error&quot;</span>}  ]
}
</pre></div>
</p>
<ul style="padding: 0;text-rendering: inherit;margin: 0 0 0 1em;line-height: \
inherit;white-space: normal;"> <li style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: normal;">Before use VoikkoDict based chekkers \
must be ensured to be with valid with initFailed().  As so the ctor is protected and \
only accessible from friens class VoikkoClient, which  does this check before \
returning the speller. Using an invalid speller will result in  null-pointer \
exceptions.</li> </ul>
<hr style="text-rendering: inherit;margin: 0;padding: 0;white-space: normal;border: \
1px solid #ddd;line-height: inherit;" /> <p style="padding: 0;text-rendering: \
inherit;margin: 0;line-height: inherit;white-space: inherit;">Implement \
Sonnet::Client for Voikko speller</p> <ul style="padding: 0;text-rendering: \
inherit;margin: 0 0 0 1em;line-height: inherit;white-space: normal;"> <li \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
normal;">Reliability set to 50.  Voikko is primarily only used for Finnish at the \
moment, although  the HFST transducer-backend has added support for other languages
  of varying quality.
  As for Finnish (99% of use cases) the results are top quality.</li>
</ul>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">In any case the reliability should be higher than that \
of hunspell  and aspell to prevent them from kicking in for Finnish, as the
  Finnish dictionarys for them are low-quality.</p>
<ul style="padding: 0;text-rendering: inherit;margin: 0 0 0 1em;line-height: \
inherit;white-space: normal;"> <li style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: normal;">Name is "Voikko"</li> </ul>
<hr style="text-rendering: inherit;margin: 0;padding: 0;white-space: normal;border: \
1px solid #ddd;line-height: inherit;" /> <p style="padding: 0;text-rendering: \
inherit;margin: 0;line-height: inherit;white-space: inherit;">Add in CMakeBits needed \
to compile Voikko speller.</p> <ul style="padding: 0;text-rendering: inherit;margin: \
0 0 0 1em;line-height: inherit;white-space: normal;"> <li style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">Added \
FindVOIKKO module</li> </ul></pre>
  </td>
 </tr>
</table>



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>cmake/FindVOIKKO.cmake <span style="color: grey">(PRE-CREATION)</span></li>

 <li>src/plugins/CMakeLists.txt <span style="color: grey">(3d24d61)</span></li>

 <li>src/plugins/voikko/CMakeLists.txt <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>src/plugins/voikko/voikkoclient.h <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>src/plugins/voikko/voikkoclient.cpp <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>src/plugins/voikko/voikkodebug.h <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>src/plugins/voikko/voikkodebug.cpp <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>src/plugins/voikko/voikkodict.h <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>src/plugins/voikko/voikkodict.cpp <span style="color: \
grey">(PRE-CREATION)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/124282/diff/" style="margin-left: \
3em;">View Diff</a></p>






  </td>
 </tr>
</table>







  </div>
 </body>
</html>


--===============8513581250019642192==--


[Attachment #3 (text/plain)]

_______________________________________________
Kde-frameworks-devel mailing list
Kde-frameworks-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-frameworks-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic