-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
The three rules of Ruby Q.:
-
Please do not post any solutions or spoiler discussion for this
quiz until 48 hours have elapsed from the time this message was
sent. -
Support Ruby Q. by submitting ideas and responses
as often as you can!
Visit: http://rubyquiz.strd6.com/suggestions -
Enjoy!
Suggestion: A [QUIZ] in the subject of emails about the problem
helps everyone on Ruby T. follow the discussion. Please reply to
the original quiz message, if you can.
RSS Feed: http://rubyquiz.strd6.com/quizzes.rss
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Adaptive Text Editor (#217)
Mbote Rubyists,
Sometimes the auto-completion features of text editors leave much to
be desired. I’ve dreamed of a day when editors could successfully
anticipate my actions to a high degree of accuracy.
This week’s quiz is to create an auto-completion module that will scan
a corpus of text and use it to generate an auto-completion list. The
adaptive part comes in where the most chosen auto-completion options
appear first and the least used eventually drop off the list.
Additionally if the text that is scanned was part of a project written
by the user then the editor will be adapting the the user in that way
as well.
It is not necessary to write an entire editor for the quiz. The
simplest solution would be something like a class that can be
initialized on a collection of files or text and have an
autocomplete
method that takes the most recently typed letters as a
parameter. The method could also have optional parameters, such as a
context, to be used to enhance the accuracy of the suggestions. Some
contexts that would be most useful would be inside a a class
or
inside a method body
. It could even get fancier by having the
specific class that it is called in passed as an option as well, so as
to suggest methods in that class higher than other methods.
As always you can embellish as much or as little as you wish. All
solutions are welcome.
Have Fun!