minor doc update
[spray] / Readme.org
index 887294e21d36b99352719bc17f6f34da8275412c..c65798deb9a813cf0c7012ff35c5bae8ec5b19fa 100644 (file)
@@ -96,7 +96,31 @@ You may customize spray by modifying following items:
 - [Face] spray-base-face
 - [Face] spray-accent-face
 
+** Algorithm details
+
+*** Main algorithm code location
+In =./spray.el=, the functions =spray--word-at-point=, =spray--update= and =spray-start= contain the main algorithm of choosing a word, an accent character and an interval to display it. Word splitting is also duplicated the same way as in those functions throughout ./spray.el.
+
+*** Algorithm translated from code to english
+
+Words are split at space, tab and newline characters, and if any of the characters =.!?;= appear in a word, a blank word is appended to the current word.
+
+Each word is displayed for (60 / the choosen wpm) seconds, except if the word contains : or , or is greater than 9 characters long, in which case it is displayed for twice as long.
+
+The accent location is chosen as the nth character in a word, depending on its length, based on the following table
+| length | accent position |
+|      1 |               1 |
+|    2-5 |               2 |
+|    6-9 |               3 |
+|  10-13 |               4 |
+|    14+ |               5 |
+
+*** Why?
+Based on a quick count, similar programs are implemented in 6 languages, 9 platforms and 11+ projects. Every one has a similar algorithm to choose a word, an accent character and an interval to display it. How to do that best is quite important. However, how each project does it is generally buried in unrelated code, and mostly undocumented. It is prohibitively time consuming to figure out the algorithm and differences between them for each project. This sucks. Users would like to know so they can pick one. Developers would like to know so they can get ideas and spread improvements among different projects.
+
+So, I am opening a bug on every project I find, asking them to document what file and function(s) their algorithm is implemented in, and preferably to document it in english as well. The following is an example.
+
 
 ** Contributions are welcome!
 
-There's lots of features and enhancements to do. The algorithm has lots of room for improvement. Also, other projects may have algorithm improvements we can port over to this one.
+There's lots of features and enhancements to do. The algorithm and interface could certainly be improved in various ways.