Sha256: a97267a19c9073b10dc5ae2caca581935e8cbd5798389fad8b4c377323427bab

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

%p An unsupervised language identification algorithm. Trained on tweets with lang = "en" according to the Twitter API (which, in practice, returns tweets in Spanish, Portuguese, Dutch, Russian, and a couple other languages as well). More information <a href="http://blog.echen.me/2011/05/01/unsupervised-language-detection-algorithms/">here</a>.

%form{ :action => "/", :method => "post" }
  %label{ :for => "sentence" } Sentence
  %input{ :id => "sentence", :name => "sentence" }
  %button{ :type => "submit" } Detect Language

- if @sentence and !@sentence.empty?
  %p
    %strong= @sentence
    is
    %span{ :class => "#{@language == "English" ? "english" : "other"}"}= @language
    
%table
  %tr#header
    %th.language Language
    %th.tweet Tweet

:javascript
  function addTweet() {
    $.ajax({
        method: 'GET',
        url: '/tweet',
        cache: false,
        success: function(data) {
            $("table tr#header:first").after(data).slideDown('slow');
            setTimeout(addTweet, 500);                
        }
    });
    $('table tr.tweet:gt(20)').remove();
  }
  
  $(function() {
    $("form").inlineFormLabels();
    setTimeout(addTweet, 500);
  });

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
unsupervised-language-detection-0.0.4 website/views/index.haml
unsupervised-language-detection-0.0.3 website/views/index.haml
unsupervised-language-detection-0.0.2 website/views/index.haml
unsupervised-language-detection-0.0.1 website/views/index.haml