Parsivar: A Language Processing Toolkit for Persian
Paper · 2018 · Salar Mohtaj, Behnam Roshanfekr, Atefeh Zafarian et al.
Summary
A Persian word can contain a visible space even when its parts belong together. The same word can also look identical in different documents while being stored as different characters. These variations matter because a computer can count, compare, or label the same word differently depending on how it was written. Parsivar is a Python toolkit for natural language processing that addresses these problems before they spread through later stages of analysis. It standardizes character representations, repairs spacing, and divides the resulting text into words and sentences.
The paper offers two ways to repair spaces inside words. The first uses written rules for recurring patterns and a dictionary for expressions that need individual treatment. The second learns from the Bijankhan corpus, whose entries show which written parts belong to the same word. Parsivar also includes stemming, which groups related word forms under a common representation, and part-of-speech tagging, which assigns grammatical categories to words. Its shallow parser uses those categories to identify local phrases such as noun phrases and verb phrases. The toolkit brings together methods that draw on different resources, from the character variants found in Persian weblogs to grammatical labels supplied by human annotators.
The authors test individual components and then ask whether the choice of preprocessing toolkit affects a complete application. On a sample of documents from Hamshahri, word tokenization reaches 98.29% accuracy among the words retained after stop-word removal, and stemming reaches an F-measure of 89.53%. The authors also compare grammatical taggers and manually assess the shallow parser. Their most direct comparison with other toolkits comes from Persian plagiarism detection. They hold the detector fixed, supply text prepared by Parsivar, Hazm, or ParsiPardaz, and examine how well each configuration recovers reused passages while varying the similarity cutoff.
Parsivar gives the detector the highest character-level F-score throughout the threshold sweep shown in the paper. The abstract describes the downstream advantage as about 8 percent in F1. The authors attribute the improvement chiefly to normalization and better word boundaries. That explanation fits the way this detector compares sentences: character variants and stray spaces can stop related sentences from sharing the same terms. The comparison measures the combined effect of switching toolkits. How much of the improvement comes from character normalization, spacing repair, or other preprocessing decisions remains open.
Deep dive: Parsivar: A Language Processing Toolkit for Persian
Parsivar standardizes Persian text, repairs word boundaries, and improves a plagiarism detector by changing how its input is prepared. · about 33 minutes to read
The problem and its context
A visible word and a stored word
The paper starts with text collected from the Web. Its authors describe an environment in which documents come from many writers, whose conventions differ even when they are writing the same language. At the level of the stored document, variation can appear in the character representations used for letters and punctuation. At the level of spelling and layout, it can appear in where writers put spaces. These are separate problems. Choosing a canonical representation for a character gives a program a consistent way to recognize it. Deciding whether a visible space marks a word boundary requires a judgment about the material around it.
The paper illustrates the first problem with the Persian word for water. A reader can recognize the intended word across documents, while software that distinguishes the underlying representations can end up treating the occurrences as separate terms. The authors note similar variation in punctuation. There, the choice of representation affects more than whether a symbol can be matched in a search. Punctuation also helps the toolkit identify boundaries, so its treatment can change what gets sent to a sentence splitter or a word tokenizer.
Spacing causes a different failure. The authors describe Persian words whose parts may be written with a full space, with a half-space, or joined together. A half-space, in the paper's terminology, is a zero-width character that prevents joining. It lets adjoining pieces remain visually distinct without putting a full blank between them. Where a writer uses a full blank instead, a program that splits mechanically at every space will produce separate tokens. In the paper's example, the Persian expression for “programmer” is intended to be processed as one unit. A commonplace spelling with a full space can fool a splitter into handing its pieces to every later stage as separate words.
The cost of such a split depends on the application. A tagger assigns grammatical labels to the units it receives, so a misplaced boundary changes the labeling problem itself. A sentence comparison procedure counts the terms actually present in its input, so separate spellings can obscure shared material. The scientific question is therefore larger than whether normalized Persian looks more consistent on screen. It is whether the resulting representation supports the operations a later component is trying to perform.
Persian morphology adds another layer. The paper describes a variety of prefixes and suffixes, as well as verbs whose forms are built on different roots for past and present constructions. Once a program has decided where a word begins and ends, it may still need to decide which part of that word should serve as its representative form. Related written forms can remain distinct after every character and boundary has been standardized. The stemmer addresses that distinction, while the tagger and shallow parser work with grammatical categories and phrases.
What earlier tools already offered
Persian preprocessing packages existed before Parsivar. The authors describe STeP1 as bringing together word splitting, morphological analysis, and grammatical tagging. They present ParsiPardaz as extending a similar collection of capabilities with operations such as normalization and spelling correction. They identify public source availability as a practical obstacle for these packages. Hazm, in contrast, was available as an open-source package and supplied normalization, tokenization, and grammatical labeling. In reviewing existing tools, the authors characterize Hazm as faster than STeP1 and ParsiPardaz and describe its output as less accurate. They later use Hazm and ParsiPardaz as the comparison systems in their own downstream experiment.
The stemmer also has its own line of prior work. The paper points to the Lovins and Porter stemmers as examples of how rules can strip affixes from English words. The relevant precedent is the use of recurring word structure to reduce variation. A Persian stemmer requires rules for Persian constructions and decisions about which resulting forms to accept. The authors cite earlier Persian stemming work, including a Farsi stemmer whose treatment of possessive and plural endings informs how they organize their own rules.
For grammatical tagging, the authors build on supervised methods whose training examples pair words with assigned categories. They cite maximum entropy work on part-of-speech tagging and work on enriching the features available to a maximum entropy tagger. They also draw on conditional random fields, which score a sequence of labels given the words of a sentence. The Persian-specific work in Parsivar lies in choosing the training material, reducing the annotation inventory, and deciding which words and preceding labels supply useful evidence.
The situation for shallow parsing was different. The paper describes both rule-based and learned approaches to dividing sentences into phrases. A learned phrase finder needs examples that identify where phrases begin and end and what kinds of phrases they are. The authors judged that a suitable Persian dataset was unavailable for this purpose. They chose to write patterns over grammatical labels instead. This gives Parsivar a way to produce phrase boundaries from a tagger's output using resources different from those required to train a tagger.
These choices explain why the toolkit combines techniques instead of using a single learning procedure throughout. Persian weblogs give the authors examples of character variation encountered in ordinary documents. The structure of Bijankhan entries supplies evidence about multi-part words, and the corpus's grammatical annotations support tagger training. Word lists and written patterns serve the stemmer and shallow parser. The experiments then ask different questions according to the evidence available for each task.
The method, step by step
From a document to a sequence of words
Parsivar is an integrated Python package, and the authors make it available as Parsivar for research use. Its components address different representations of the same text. The normalization and spacing stages work with the characters and separators in a document. The tokenizer produces sentence and word units. Stemming gives a word a more general form for comparison, while grammatical tagging gives it a category in its sentence. Shallow parsing specifically takes the sequence of grammatical tags as input. Stemming and tagging therefore represent different uses of the tokens, and the paper describes the toolkit as allowing users to balance speed and accuracy according to their needs.
How Parsivar prepares and analyzes Persian text
The steps in order.
The character normalizer begins with evidence from Persian weblogs. The authors gathered a collection of more than 2 million documents and used it to identify alternative representations for characters. They then use a standard form for each character the toolkit normalizes. This addresses discrepancies in a word's written representation before the program decides which characters belong to that word. The same principle applies to punctuation, where a consistent representation also supports the next decision about boundaries.
Character normalization by itself leaves the word for “programmer” vulnerable to a full space between its parts. The spacing stage looks for cases like this while the surrounding pieces are still available together. Once those spaces have been corrected, the tokenizer uses spaces and punctuation to divide the document. The order matters because spacing repair can preserve a multi-part word as the unit on which the next decisions operate. The authors supply a rule-based procedure and a learned procedure for making the repair.
Repairing spaces with patterns and a dictionary
The rule-based procedure starts with regular expressions. A regular expression describes a recurring pattern in text, so a rule can recognize an arrangement of letters and spaces across many inputs. The examples in the paper include the Persian form glossed as “I'm going,” as well as words glossed as “geologist” and “analyzer.” Their structures give the authors cases for which a written pattern can tell the program when adjacent pieces should be kept together.
A pattern is most useful when an arrangement recurs frequently enough and is specific enough to justify the same decision in new text. Some words have multiple pieces whose combination is easier to state as a dictionary entry. The authors give the Persian word for “conversation” as an example. They collect such forms in a dictionary and look for them in sentences. A dictionary entry therefore records a particular combination, whereas a regular expression expresses a generalization about combinations. Both support the same operation of repairing a separator, but they draw their evidence from different places.
This distinction also explains what maintenance means for the rule-based correction. Adding a dictionary entry covers another expression. Adding or broadening a regular expression can change the treatment of every expression that fits it. The paper describes these mechanisms and gives examples of each. Its account establishes how the rules and dictionary are meant to complement each other, while the experiments reported for spacing focus on the procedure learned from annotated examples.
Learning where a multi-part word ends
The learned correction uses a property of Bijankhan. In that corpus, the separate pieces of a multi-part word appear together in a single entry. The authors turn that organization into a sequence-labeling task. A label of B marks the beginning of a multi-part word. I marks each subsequent part that continues it. O marks a word standing outside such a group. These labels are known as IOB notation. Here they encode word membership among pieces that can be separated by visible spaces.
Imagine the representation of the programmer example before repair. The first piece would receive B and the next piece I if the classifier identifies the intended word. Joining the pieces follows from the labels. In surrounding text, a unit marked O remains outside the group. The target is thus a sequence of decisions that can be converted back into boundaries. The classifier can be trained using the way the corpus already groups pieces, without requiring the authors to prepare a separate annotation for every kind of spacing problem from scratch.
For each position, the paper specifies three sources of evidence: the previous word's label, the previous word itself, and the following word. The neighboring words supply information about which combinations occur. The preceding label tells the classifier whether earlier material has already been identified as the beginning or continuation of a word. A Naïve Bayes classifier learns from the association between these features and the labels in the training material. The pipeline then interprets the assigned labels as word boundaries instead of leaving IOB labels as the final product.
The authors set aside 90% of Bijankhan for fitting the spacing classifier and reserve the remaining 10% for validation. The experiments describe the target as I, O, and B. The initial method description refers at one point to classification into B and I, even though its preparation of the data includes O. The experimental procedure supplies the fuller account of the label inventory. The paper describes the features and the use of the predicted sequence to recover boundaries. Details such as how the first position gets its preceding-label feature and how an inconsistent sequence is resolved are left open.
Finding common forms for verbs and other words
A correctly identified word can still occur in several forms. The authors use stemming to make those forms easier to compare in applications such as information retrieval. Their criterion is practical. A stem can be useful if it puts related forms together for the application. The paper treats this as a different objective from recovering a linguistically exact root in every case.
The stemmer divides its rules into those for verbs and those for other words. The reason is easiest to see in the verbs. A written form can contain tense-related material, a root, and an ending that identifies the person. The paper's examples show the element transliterated as mi with a past root and past-person ending in the expression glossed as “I was going.” A present root and present-person ending occur with mi in the expression glossed as “I'm going.” The future example, glossed as “I will go,” uses khah, a present-person ending, and a past root. Recognizing a verb construction therefore involves more than stripping the same ending from every word.
In the verb algorithm, the input is checked against construction rules. A match supplies a candidate root, which is looked up in the verb dictionary. The authors prepared this dictionary with both past and present roots. The pseudocode collects the candidates that match the dictionary and returns the shortest one if there is a choice. If it finds no candidate, it returns the original input. The prose account instead says that the first root found in the dictionary is returned. Both accounts require dictionary confirmation, but they imply different outcomes when several candidates qualify and the first is longer than another. The paper gives no further ordering detail that settles that case.
Prefixed verbs receive additional treatment. The authors describe checking for a known prefix at the start of the form, removing it, and searching for the stem of the remainder recursively. This lets the search apply the verb analysis again to the shorter form. The prefix procedure is described alongside the construction rules, while the printed algorithm concentrates on the matching and dictionary checks. Together they explain the aim of making candidate generation sensitive to the structure of Persian verbs.
For words outside the verb class, the paper organizes affixes by their position and function. On the leading side are prefixes. After the stem in reading order may come other suffixes and then plural and possessive endings. The example glossed as “their books” contains the base for “book,” a plural marker, and a possessive ending. The distinction between those endings gives the procedure a basis for deciding where to look and in what order to try the categories. The paper also illustrates other affix types with words glossed as “powerful” and “quiet.”
The non-verb pseudocode prints the following operation for a matching ending.
w′ = w[0 : len(w) − len(s)]
Here w is the input form, s is the matching ending, and w′ is the candidate after removal. The function len gives the length of its argument. The brackets denote a slice of w that begins at position 0. The colon separates that starting position from the endpoint, which is the length of w minus the length of s. Subtraction places the endpoint immediately before the ending being removed. The equals sign assigns the sliced form to w′.
The authors check the residual form against a lexicon of 21,151 Persian stems. A matching candidate is eligible as the result, and the pseudocode chooses the shortest eligible candidate. Returning the original word when none qualify prevents an affix match alone from authorizing a reduction. The prose describes a broader sequence in which it tries the possessive class, the plural class, the other suffixes, and prefixes, removing affixes before checking the remainder. The printed slice only illustrates removal from the end of a word. In particular, it leaves the mechanics of prefix removal and the state of the word between successive removals less explicit than the prose description does.
Assigning grammatical categories in context
Part of speech is a category such as noun or verb. A tagger assigns a grammatical category in the setting in which a word appears. The paper illustrates this with a short sentence about going to school and its Persian counterpart. The predicate, the place word, the preposition, and the punctuation can each receive a different label. Patterns of those labels give the phrase finder a compact description of the sentence. The paper also points to other uses for grammatical tags, including named entity recognition and machine translation.
The authors train maximum entropy and conditional random field taggers. Both learn from sentences whose tokens have already been tagged. Maximum entropy gives a way to score a tag at a position using features of the surrounding context. A conditional random field, abbreviated CRF, gives a conditional score to the tag sequence using assumptions about dependencies within it. The paper uses Stanford software for maximum entropy, drawing on Stanford's feature-rich tagging work, and Wapiti for conditional random fields.
Training uses the grammatical annotation in Bijankhan. The authors describe a collection with more than 2.6 million manually tagged words and an inventory of 550 tags. They omit finer distinctions to work with 40 tags. This changes what counts as a correct answer. A successful prediction must match the retained grammatical distinction, while some distinctions that could have made two annotations different in the original corpus fall outside the target inventory. The corpus thus supplies supervision, but the authors define the prediction problem by deciding which categories to keep.
The paper writes the maximum entropy treatment as a factorization of the probability of a tag sequence, followed by a local approximation. Ranges in the expressions below include both endpoints.
p(t₁:ₙ | s₁:ₙ) = ∏ᵢ₌₁ⁿ p(tᵢ | t₁:ᵢ₋₁, s₁:ᵢ) ≈ ∏ᵢ₌₁ⁿ p(tᵢ | hᵢ)
Here p denotes probability and the vertical bar means “given.” The sentence contains n words, i is the current position, sᵢ is its word, and tᵢ is its proposed tag. The range s₁:ₙ refers to all the words from the first position to the last, and t₁:ₙ denotes the corresponding tags. In the first product, t₁:ᵢ₋₁ means all the tags before position i, and s₁:ᵢ means the words through the current position. The comma separates sources of conditioning information. The product sign ∏ indicates multiplication across positions, beginning when i equals 1 and ending at n. The equals sign joins the sentence-level probability to the first product in the paper's presentation. The approximation sign ≈ introduces the version using hᵢ, the context chosen for position i.
The second expression specifies that context more directly.
p(t₁:ₙ | s₁:ₙ) ≈ ∏ᵢ₌₁ⁿ p(tᵢ | tᵢ₋₂:ᵢ₋₁, sᵢ₋₂:ᵢ₊₂)
The symbols p, t, s, i, and n, the vertical bar, and the product have the same meanings as above. The tag range tᵢ₋₂:ᵢ₋₁ starts two positions before i and ends at the preceding position. The word range sᵢ₋₂:ᵢ₊₂ starts two positions before i and ends two positions afterwards. Subtraction and addition set those offsets, and the comma separates the tag range from the word range. The range notation expresses the features in the paper's prose: the current word, words on either side, and preceding tags. The approximation sign again marks the use of local context. At the end of tagging, the procedure selects the sequence with the highest probability under its scoring method.
There is a subtlety in the first expression. Its left side conditions on the entire sentence. The first product on the right conditions on words only through the current position. A general factorization of a distribution conditioned on the entire sentence would keep that sentence in the conditioning information for each factor unless a restriction justified dropping later words. The paper's chosen feature window actually includes later words. Its second expression and accompanying feature description give the clearest account of the local information the authors use.
For the CRF, the paper identifies the quantity being estimated as follows.
p(T | S)
Here T stands for the whole sequence of grammatical tags and S stands for the sentence as a sequence of words. As before, p is a probability and the vertical bar denotes conditioning. The paper describes the CRF in terms of assumptions about dependencies and names the software used for training. Its feature comparison considers different amounts of local context, with the selected context including neighboring words as well as preceding tags in the paper's description of the tagging features.
Finding phrases from tag patterns
Shallow parsing, also called chunking, groups syntactically related words into spans. A group gets a label describing the kind of phrase it contains. Because the spans do not overlap, no word can be part of more than one chunk. This representation can mark the noun phrase in a sentence and identify a separate verb phrase without giving a complete account of how the phrases attach to one another.
Parsivar uses regular expressions over grammatical labels at this stage. The paper's noun-phrase example can be written in sentence order as follows.
NP: {<N_SING><ADJ_SIM><N_SING>}
NP is the output label for a noun phrase. The colon introduces its pattern, and the curly braces mark the stretch that becomes a chunk. Each pair of angle brackets encloses a tag that must match a token in that position. N_SING is the singular-noun tag and ADJ_SIM is the simple-adjective tag. The repeated N_SING signifies that the adjective lies between two singular nouns. The paper illustrates the match with a Persian expression meaning “exact thickness of the planet.” To apply the rule, the phrase finder needs the grammatical labels in the right order. The particular words serve to illustrate that pattern.
For noun, verb, and prepositional phrases, the authors write a total of fifteen patterns. The rules let them build a chunker without using annotated phrase spans to train it. At the same time, the phrase grouping inherits decisions already made about tokens and tags. If the input is divided into the wrong units or a noun receives a different label, the sequence the chunker examines can differ from the one the rule was written to recognize.
Experiments and results
Tokenization and stemming on Hamshahri
The paper distinguishes intrinsic assessment, which tests an operation against judgments about its own output, from extrinsic assessment, which measures what happens when that output is used by an application. The intrinsic experiments differ in size, unit, and form of supervision. The authors explain that limited resources led them to inspect some results manually. An accuracy on a selected set of words, a score for a learned spacing procedure, and a manual assessment of phrases consequently refer to different tasks.
For word tokenization and stemming, the authors draw 10 documents at random from Hamshahri. The sample contains 2552 tokens initially. Removing stop words leaves 1465 words for the reported assessment. A stop word is a term a processing procedure excludes under its chosen filtering convention. The paper reports 98.29% tokenization accuracy among the words that remain. The result belongs to this sample and this filtered denominator. A reader comparing it with a tokenization result elsewhere would need to know whether punctuation, often occurring grammatical words, and segmentation disagreements were counted in the same way.
The stemmer has 98.71% precision, 81.91% recall, and an F-measure of 89.53% on the Hamshahri assessment. Precision and recall capture different aspects of the result. Precision concerns how often the reductions credited by the procedure are correct, while recall concerns how many of the reductions sought by the assessment are found. F-measure combines the two. The reported precision is higher than recall. That pattern supports a description of the stemmer as more successful at keeping accepted decisions correct than at recovering the full set of expected reductions. It is consistent with dictionary checks restricting what the procedure will accept, although the paper gives no error counts by cause that would isolate the effect of those checks.
Learned spacing on Bijankhan
The spacing experiment uses a dataset constructed from Bijankhan's multi-part entries. It contains 2,428,732 O labels, 160,775 B labels, and 169,518 I labels. The counts show that the class for words outside multi-part groups is much more common than either boundary-related class. Consequently, the rate of correct IOB decisions can tell a different story from measures aimed at recovering the word groupings that motivated the procedure.
The experimental section trains the Naïve Bayes classifier on 90 percent of this dataset and validates it on the remaining 10 percent. The table reports 93.2% IOB accuracy, 87.3% precision, 91.9% recall, and 89.5% F-measure. IOB accuracy concerns agreement between predicted and reference labels. The table presents the other measures alongside it as results for space correction. It gives the reader a view beyond the aggregate tag accuracy, though it does not detail exactly how a partly correct multi-part word is scored.
The method section separately gives 96.5% as an F1 score for spacing correction on the Bijankhan validation set. It describes the same training and validation proportions. The paper leaves the relationship between this value and the table's 89.5% F-measure unexplained. It could matter whether results were counted over individual labels, complete words, or some other unit, and the authors supply too little scoring detail to resolve that question. The tabulated F-measure and the method-section F1 are best read as distinct reported figures with an unresolved difference.
Grammatical tagging with different amounts of context
The authors train the maximum entropy and CRF taggers using one million words from Bijankhan and test them on 10 percent of the corpus. They vary the input window and consider accuracy at the level of individual words and complete sentences. Word accuracy gives each tag decision a chance to contribute to the result. Sentence accuracy requires the tagging of the full sentence to be correct. A sentence with an isolated labeling mistake can therefore fare quite differently under the two measures.
For window size 3, the maximum entropy tagger's word-accuracy entry is 0.91 and the CRF entry is 0.93. At window size 5, both entries are 0.95. The corresponding sentence-accuracy entries are 0.75 and 0.76 for window size 3, and 0.78 and 0.79 for window size 5, with maximum entropy followed by CRF in each pair. The paper's table labels the columns as percentages but prints decimal entries. The figures here retain that printed form.
Complete-sentence tagging accuracy on the Bijankhan test split
Both taggers score higher with the wider window, and CRF has the highest complete-sentence accuracy.
The numbers
| System or setting | Accuracy as printed |
|---|---|
| Maximum entropy, window 3 | 0.75 |
| CRF, window 3 | 0.76 |
| Maximum entropy, window 5 | 0.78 |
| CRF, window 5 (this paper) | 0.79 |
The shared word-level result at window size 5 makes sentence accuracy informative. The taggers match the same reported proportion of word labels at that precision of reporting, while the CRF has the higher entry for completely correct sentences. Those figures can coexist if the errors are distributed differently across sentences or if the word-level entries hide a difference at finer precision. The table gives aggregate accuracy and leaves those explanations open.
The shallow parser is assessed separately on 100 randomly selected sentences from Hamshahri. The manual evaluation produces a reported performance of 76.8%. The paper calls this figure performance without identifying a named metric or specifying how partial agreement with a phrase boundary contributes. The authors point out that the chunker uses predicted grammatical labels, so errors at the tagging stage can account for some phrase errors. They assess the chunker as it receives those tags in use. A controlled comparison with manually supplied tags would be needed to estimate that contribution separately.
Comparing toolkits through plagiarism detection
The downstream experiment asks whether the representation produced by preprocessing affects which reused passages a detector recovers. The experiment draws on part of a Persian text-alignment corpus for plagiarism detection and also uses a Persian resource developed for extrinsic detection with artificial obfuscation. The paper uses these resources to evaluate a sentence-based detector after supplying text prepared by Parsivar, Hazm, or ParsiPardaz. The detector is held fixed across toolkit comparisons.
The general setup begins with a suspicious document d_q and a collection D of possible source documents. A retrieval step can select a smaller set D_x of plausible sources. The detailed stage compares a section s_q of the suspicious document with a section s_x taken from a candidate source d_x. The candidate document belongs to D_x. The aim is to recover section pairs that are sufficiently similar. This description supplies the setting for the experiment, whose concrete comparison uses sentences as the sections being scored.
In the experiment, each sentence becomes a vector of term weights. The vector-space procedure uses TF-IDF, a weighting scheme that uses how a term occurs and how broadly it is distributed. Cosine similarity then compares the direction of two weighted vectors. In practical terms, sentences that share informative terms can receive a high score even if the total weights in their vectors differ. The detector compares the suspicious document's sentences with sentences in the source documents and labels sufficiently similar pairs as cases of reuse. The threshold determines how much similarity is sufficient.
The toolkit can affect both which terms occur and which sentences get compared. If a variant encoding creates a distinct term, two otherwise comparable vectors may have fewer shared entries. If an internal space produces separate terms, the same word can contribute as a whole in one sentence and as separate pieces in another. Preprocessing can change those outcomes before any similarity scores are computed. This is what makes the fixed detector a way to measure the application-level consequences of changing the input preparation.
The detector's final score evaluates agreement at the character level. In the following expressions, an overlap refers to the parts of a reported and an annotated passage that coincide. The union combines covered characters before measuring their extent, so a character covered by several matching portions within that union contributes only once to its length. Precision averages the covered fraction of each reported case.
Precision(S, R) = (1 / |R|) × ∑ᵣ∈ᴿ (|⋃ₛ∈ₛ (s ⊓ r)| / |r|)
S is the set of annotated plagiarism cases in the suspicious documents, and R is the set of cases returned by the detector. Lower-case s denotes one annotated case and lower-case r one returned case. In ⋃ₛ∈ₛ, the first s is the case and the final subscript denotes the set S. The symbol ∈ means membership in the set. The overlap operation ⊓ gives the characters common to a pair of cases, and ⋃ takes the union of those overlaps over the annotated cases. Vertical bars give character length for a passage or combined overlap and set size for |R|. The slash divides the length of the overlap by the length of the reported case. The sum ∑ accumulates these fractions over the returned cases, and the factor 1 / |R| averages them. The multiplication sign × applies that factor, and the equals sign defines precision.
Recall reverses the direction of the coverage question. It takes each annotated case and measures how much of it is covered by the detector's reports.
Recall(S, R) = (1 / |S|) × ∑ₛ∈ₛ (|⋃ᵣ∈ᴿ (s ⊓ r)| / |s|)
Again S is the annotated set, R is the reported set, s is an annotated case, and r a reported case. In ∑ₛ∈ₛ, the final subscript denotes the set S. The sum ranges over that set, as indicated by ∈. For each s, the overlap operator ⊓ and the union ⋃ combine the characters covered by cases r in R. The bars in the fraction below the summation give character lengths, and the slash divides the covered length by the length |s| of the reference case. The bars in |S| instead give the number of reference cases. Multiplying by 1 / |S| averages the fractions over those cases. The equals sign defines recall.
The paper combines these measures as follows.
F₁ = 2 × (Precision × Recall) / (Precision + Recall)
F₁ is the resulting F-score. Precision and Recall are the character-level averages just defined. The multiplication sign forms their product, the plus sign forms their sum, and the slash divides the product by that sum. The factor 2 scales the result to the harmonic mean of the two values. The equals sign states the definition. This score makes over-reporting and missed coverage visible in the same comparison. Returning a long passage that contains an annotated passage can recover its characters while also adding material that reduces precision. A short report lying inside one annotated passage can achieve good precision for that report while leaving part of the reference case unrecovered.
The threshold sweep in the paper plots the character-level F-score for the three toolkits. The similarity thresholds shown range from 0.05 to 0.95. The authors report that Parsivar leads at every threshold shown. Their abstract describes the gain as about 8 percent in F1. Individual F-scores are presented as curves, without a table of exact scores at the separate thresholds or a stated calculation that ties the abstract's figure to a particular point on the sweep. The ordering across the displayed settings is therefore the most directly supported account of the downstream comparison.
What the ablations show
The paper does not report a module-by-module ablation of Parsivar, but it does compare tagging contexts and classifier families and test the sensitivity of the downstream result to the detector's similarity threshold.
The tagger comparison is the clearest controlled change to a component. Widening the window improves reported accuracy for both methods and for both units of evaluation. This supports the authors' choice to use context on both sides of the current word. The experiment changes the window as a group. It leaves open how much of the improvement comes from the additional preceding word, the additional following word, or how the full feature set works together. That is an important distinction for interpreting the result. Evidence for a wider window is stronger here than evidence for the contribution of any single position in it.
Comparing the classifier families at a given window size addresses a different question. CRF leads on both metrics at window size 3. At window size 5 the word-accuracy entries coincide, while CRF retains the higher sentence-accuracy entry. The comparison therefore gives some support to CRF on this corpus and tag inventory, particularly when complete sentences are the unit of interest. There is little basis for turning those aggregate entries into a diagnosis of specific errors. The table does not say whether the methods disagree more often on particular categories, on uncommon words, or in sentences whose tokens have ambiguous boundaries.
The threshold sweep changes a decision in the application rather than in preprocessing. A stricter cutoff changes which sentence pairs become returned passages. A more permissive cutoff changes the balance of recovered and spurious text. Parsivar's position above the other toolkits across the sweep makes the observed ordering less dependent on picking a favorable threshold for one setup. The comparison keeps the detection procedure shared and changes the toolkit supplying its input. Its strongest inference is accordingly about using Parsivar as a package in this detector.
The authors argue that normalization and tokenization account for much of the downstream advantage. The structure of the detector gives their explanation a concrete mechanism. Equivalent strings that become identical after normalization can contribute shared terms. A repaired space can keep a useful term intact. Both changes can influence the vectors and their cosine scores before the cutoff is applied. The experiment changes the whole input preparation together, however. It leaves the distinct contribution of an encoding map, a particular spacing procedure, the tokenizer, and any stemming used in the downstream setup unresolved. An intrinsic result for one component and an extrinsic gain for the package answer different questions.
Two other analyses are useful as descriptions of error without serving as ablations. The high count of O labels explains why interpreting the spacing accuracy alongside precision and recall matters. The paper also identifies a plausible source of chunking errors in their dependence on the tagger. The class counts come directly from the constructed dataset. The propagation claim follows from the parser's input and is acknowledged by the authors, while the size of that effect remains unmeasured. Together these observations show where a component's input or evaluation unit matters even in the absence of a separate intervention.
Limitations
Limits the authors identify
The authors explicitly identify the shortage of suitable resources as a constraint on evaluation. Some outputs were checked by hand. The datasets that supported character discovery and supervised training did not supply a uniform benchmark for every operation in the toolkit. The evaluation therefore spans several settings: a sampled document collection for words and stems, Bijankhan for spacing and grammatical tagging, and a separate sample of sentences for chunking. Each result is evidence for its own task under that protocol. A single summary accuracy would conceal what was counted in each one.
The authors also explain the costs of writing phrase rules. A rule-based chunker can be built without a phrase-annotated training set, but writing rules that cover varied language is difficult. The rules are specific to the language and to the grammatical categories they expect. Their application can fail when a construction falls outside the patterns or when the tagger produces an unexpected label. The authors explicitly identify propagated tagging errors as one contributor to chunking errors. They propose statistical approaches to chunking as future work.
A further stated direction is Persian Ezafe recognition. The authors point to prior probabilistic work on Ezafe and plan to add recognition to the toolkit. This future-work statement defines a boundary around the contribution being evaluated. The article's evidence about grammatical tagging and pattern-based phrases comes from the tasks the authors implemented and measured in the paper.
Limits visible in the evaluation
The sample of 10 Hamshahri documents gives a concrete sense of how the tokenization and stemming checks were performed. Its reported accuracy follows stop-word removal, which means performance is conditional on that selection. The paper gives neither a document-level distribution nor uncertainty estimates for those checks. It also offers little detail about the manual verification procedure, such as how conflicting boundary decisions were handled or whether judgments were independently repeated. Generalization to the different writing conventions that motivated the project remains an open question. Weblogs contribute character variants to the normalizer, while the intrinsic word and stem scores come from Hamshahri.
The spacing evaluation uses corpus-defined units as the reference for learning and for validation. This is a practical way to obtain labels because grouping is already encoded in the entries. It tests the ability to reconstruct boundaries in a held-out portion of data prepared through the same process. It leaves open how the classifier deals with different spacing habits in documents from a new source. The discrepancy between the method section's F1 and the experimental table's F-measure further limits interpretation. Without an account of how the two scores were obtained, either number used in isolation would obscure the uncertainty in the paper's report.
The stemmer's dictionaries make acceptance of candidates depend on lexical coverage. This can help reject an apparent affix whose removal leaves an implausible form. It can also leave a legitimate form unchanged whenever its intended stem is absent from the dictionary or the necessary construction rule is missing. The relative precision and recall in the sample are compatible with that tradeoff. The report gives too little detail about particular failures to determine whether gaps came mostly from the dictionaries, from the candidate rules, or from the order in which candidates were selected. The differing prose and pseudocode accounts of verb selection and non-verb stripping also leave some edge cases underspecified.
The tagging results depend on a reduced inventory of 40 tags. That is an explicit design choice with a consequence for interpretation. The observed accuracies concern the distinctions the authors retained. A use that relies on the finer annotations excluded from training would require its own evaluation. Sentence accuracy has another dependence: a sentence offers one opportunity for a wholly correct outcome regardless of how many words it contains. The experiment leaves open how performance varies with sentence length or category frequency. The reported test figures also accompany a search over window sizes, without a separate account of how tuning and final evaluation were separated.
The shallow parser's 76.8% is particularly hard to compare with a result from another phrase finder because the manual measure is unnamed. Identifying part of a phrase, predicting its full boundary with the wrong type, and predicting its exact span and type are distinguishable events. The article gives the reader no scoring definition that determines their relative treatment. It also leaves open how far the parser's performance would change if the same rules were applied to reference tags. Its evaluation establishes a reported result for the tested combination of predicted tags and phrase rules.
The plagiarism experiment has a meaningful control in its shared detector, but its scope is one sentence-based similarity procedure applied to the selected Persian plagiarism data. An application that uses different text units or different ways of comparing words could respond differently to the same preprocessing choices. The paper's evidence concerns candidate passage recovery under character-level precision and recall. It supplies too little information about the selected material, per-resource performance, or threshold-level scores to determine how the gain varies with the source of the examples or with forms of reuse inside the collection. The abstract's approximate F1 advantage is best kept in the authors' own terms, without assigning it a threshold or interpreting it as a difference in percentage points.
The package is presented as allowing a tradeoff between speed and accuracy. The authors also describe its runtime as close to Hazm's. The report gives no timing values or experimental conditions from which to characterize that similarity in more detail. Likewise, although the toolkit descriptions include several operations, the downstream procedure gives limited detail about the exact modules and options applied in each comparison. Those gaps matter for anyone trying to reproduce the score curves or determine which configuration earns the best result for a particular processing budget.
Taken together, the limits narrow the causal interpretation of the paper's central result. The authors show that this detector performed better with text prepared by Parsivar on the material they evaluated. They give component-level evidence for several operations and a credible explanation based on character identity and word boundaries. Direct evidence for that explanation would require holding the rest of preprocessing fixed while changing one operation at a time. The reported experiments leave those individual effects open.
What came after
Ezafe recognition and grammatical tagging
Parsivar's conclusion identifies Ezafe recognition as a feature the authors wanted to add. That proposal belongs beside their existing investment in grammatical tags. In Parsivar, the tags give later components information about the local structure of a sentence, and the shallow parser turns combinations of them into phrase boundaries. A later citing study makes the relationship between Ezafe and tagging an explicit subject of investigation. It uses Transformer and attention methods for Persian Ezafe recognition and studies the role of recognition in part-of-speech tagging. The title identifies both the new recognition task and the operation from Parsivar that it relates to. Persian Ezafe Recognition Using Transformers and Its Role in Part-Of-Speech Tagging
The link between the papers is clearest at the level of the research question. Parsivar presents Ezafe recognition as future work in a toolkit that already assigns grammatical categories. The later work studies Ezafe recognition together with those categories. That goes beyond the position of Ezafe in Parsivar's conclusion, where it is a proposed addition. The citation and the later paper's stated topic establish that connection. Whether it used Parsivar's tagger, training choices, or preprocessing implementation remains unspecified.
Representing Persian text across writing systems
Another later citing work addresses Tajik–Farsi transliteration, a task concerned with rendering text from one writing system in another. Its connection to Parsivar is the problem of representation. Parsivar asks how to make different written forms of Persian consistent enough for downstream software to operate on them. Transliteration raises a broader representation question, since it must produce text in a different writing system. The title identifies the language pair and the task, and places the work in multilingual and cross-lingual natural language processing. ParsTranslit
This second connection is thematic. The citation establishes that ParsTranslit refers to Parsivar, while the transliteration title identifies the problem on which the later work concentrates. It leaves the citation's specific function open, including whether Parsivar serves as background or performs a step in the later system. The two later works thus follow different questions raised by the original toolkit. One concerns grammatical information that can enrich tagging. The other concerns the representation in which text is available for processing. Parsivar's experiments remain evidence about the effects of preparing Persian input for the tasks it evaluated.
Cite
Cite as Salar Mohtaj, Behnam Roshanfekr, Atefeh Zafarian and Habibollah Asghari. 2018. Parsivar: A Language Processing Toolkit for Persian. Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018).
@inproceedings{mohtaj2018parsivar,
title = {{Parsivar: A Language Processing Toolkit for Persian}},
author = {Salar Mohtaj, Behnam Roshanfekr, Atefeh Zafarian and Habibollah Asghari},
booktitle = {Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018)},
year = {2018},
url = {https://aclanthology.org/L18-1179/}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/mohtaj-2018-parsivar-language-processing-toolkit-persian/