indentlabs/notebook

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

Summary

Maintainability
Test Coverage
<% if analysis.dale_chall_grade %>
  <div class="row">
    <div class="col s12 m12 l12">
      <div class="card">
        <div class="card-content">
          <div class="card-title">
            <span class="right"><%= analysis.dale_chall_grade.try(:round) %> / 10</span>
            <i class="left material-icons orange-text">bubble_chart</i>
            Dale-Chall Readability Score
          </div>
          <div class="progress">
            <div class="determinate" style="width: <%= 100 * analysis.dale_chall_grade.try(:round) / 10 %>%"></div>
          </div>
          <div class="row">
            <div class="col s12 m12 l7">
              <p>
                According to this scale, your document is
                <%=
                  case analysis.dale_chall_grade.round(1)
                  when -100..4.9
                    "<strong>Understandable by the average 4th-grade student or lower</strong>.".html_safe
                  when 5.0..5.9
                    "<strong>Understandable by the average 5th- or 6th-grade student</strong>.".html_safe
                  when 6.0..6.9
                    "<strong>Understandable by the average 7th- or 8th-grade student</strong>.".html_safe
                  when 7.0..7.9
                    "<strong>Understandable by the average 9th- or 10th-grade student</strong>.".html_safe
                  when 8.0..8.9
                    "<strong>Understandable by the average 11th- or 12th-grade student</strong>.".html_safe
                  when 9.0..100
                    "<strong>Understandable by the average college student</strong>.".html_safe
                  end
                %>
              </p>
              <br />
              <p>
                The Dale-Chall Readability Score was designed by literary researchers Edgar Dale and Jeanne Chall in 1948, then significantly
                improved with a new formula in 1995.
              </p>
              <br />
              <p>
                Unlike other readability scales that attempt to measure complexity from word and sentence structure, the Dale-Chall formula
                uses a list of 3,000 predetermined words that at least 80% of fourth graders are familiar with. Any words used that aren't
                on this list are designated as potentially-difficult words.
              </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 fewer commonly-used words.
                </li>
                <li class="clearfix">
                  <i class="material-icons left red-text">arrow_drop_up</i>
                  Use more jargon and colloquial phrases.
                </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 more commonly-used words.
                </li>
              </ul>
              <br />
            </div>
          </div>
          
        </div>
      </div>
    </div>
  </div>
<% end %>