indentlabs/notebook

View on GitHub
app/views/document_analyses/readability/_coleman_liau.html.erb

Summary

Maintainability
Test Coverage
<% if analysis.coleman_liau_index %>
  <div class="row">
    <div class="col s12 m12 l12">
      <div class="card">
        <div class="card-content">
          <div class="card-title">
            <span class="right"><%= analysis.coleman_liau_index.try(:round) %> / 16</span>
            <i class="left material-icons orange-text">bubble_chart</i>
            Coleman–Laiu index
          </div>
          <div class="progress">
            <div class="determinate" style="width: <%= 100 * analysis.coleman_liau_index.try(:round) / 16 %>%"></div>
          </div>
          <div class="row">
            <div class="col s12 m12 l7">
              <p>
                According to this scale, your document is
                <% if analysis.coleman_liau_index.round > 12 %>
                  <strong>
                    Understandable by a <%= (analysis.coleman_liau_index.round - 12).ordinalize %>-year college student.
                  </strong>
                <% else %>
                  <strong>
                    Understandable by a <%= analysis.coleman_liau_index.round.ordinalize %>-grade reader.
                  </strong>
                <% end %>
              </p>
              <br />
              <p>
                The Coleman–Laiu index is a readability test designed by linguists Meri Coleman and T. L. Liau to measure the understandability of text by 
                approximating what U.S. grade level a reader must have achieved in order to fully comprehend what is being read. It was originally designed
                to assist the U.S. Office of Education calibrate the readability of textbooks used in the public school system.
              </p>
              <br />
              <p>
                The formula is very similar to the Flesch-Kincaid readability tests, but focuses primarily on the number of characters per word instead of 
                syllables per word.
              </p>
              <br />
              <p>
                A <strong>higher score</strong> on this scale indicates a document is <strong class="red-text">harder to understand</strong>.
              </p>
            </div>
            <div class="col s12 m12 l4 offset-l1">
              <p class="red-text text-darken-3">
                To <strong>raise</strong> your score on this scale:
              </p>
              <ul>
                <li>
                  <i class="material-icons left red-text">arrow_drop_up</i>
                  Use longer words.
                </li>
                <li class="clearfix">
                  <i class="material-icons left red-text">arrow_drop_up</i>
                  Use longer sentences.
                </li>
              </ul>
              <br />
              <p class="green-text text-darken-4">
                To <strong>lower</strong> your score on this scale:
              </p>
              <ul>
                <li>
                  <i class="material-icons left green-text">arrow_drop_down</i>
                  Use shorter words.
                </li>
                <li class="clearfix">
                  <i class="material-icons left green-text">arrow_drop_down</i>
                  Use shorter sentences.
                </li>
              </ul>
              <br />
            </div>
          </div>
          
        </div>
      </div>
    </div>
  </div>
<% end %>