How-to guides

on this page
grade6.5density0.52compression0.58

Each guide does one task on one real text. Six show the input, the same call in Rust, Python and the command line, and what matra prints; the three calls print the same result, and CI runs all three and compares what they print with the page. The seventh has no command-line call, because the CLI has no command for it.

GuideInputWhat it reads
Parse a sentence into its dependency treeJane Austen, one sentenceevery word's lemma, part of speech, head and relation
Find negations and modalsthe Constitution, Article I (opening)the negations and modal verbs of each sentence
Compare readability across paragraphsThe Federalist No. 10the three measures of every paragraph
Summarize a long documentDarwin, 2,214 wordsthe three sentences TextRank ranks highest
Extract a document's keyphrasesthe same Darwinthe ten phrases RAKE ranks highest
Read a Markdown document's structurea short Markdown documentsections, headings, and the quote left unparsed
Cluster sentences by meaningyour own textgroups of sentences that say the same thing, Rust and Python only

Before you start

grade5.8density0.62compressionnone

Install matra the way you mean to use it: the library, the CLI, or the Python package (Install matra). The Rust calls also need serde_json to print, which is the first line of each one: cargo add matra@0.3 serde_json.

grade6.1density0.53compressionnone

Each call reads its input from the directory it runs in, under the file name the page gives. Each page has the command that downloads it. The first call on a machine downloads the English model (about 16 MB), and every later call reads it from disk.

What is not here

grade8.4density0.61compressionnone

Analyzing a directory as a corpus has no worked example here, because each example pins the output of one input. The CLI, Rust and Python guides cover it.

This page, measured by matra 0.3.0 with english-ewt-ud-2.5-191206: 4 paragraphs, in the margin. the data