Tool in Mylly: Relation algebra / Keep with count | fi

Keep/count selected attributes

The ”keep with count” operation projects an input relation to the selected attributes with the addition of a new count attribute to record the multiplicity in the input relation of the kept combinations.

The input and output relations are represented as TSV files.


  • name for the count attribute
  • zero or more attributes

Attributes are presented as menus that list the attributes that the relation has. EMPTY indicates that the parameter is not used.

Selecting the same attribute more than once is harmless.

(Selecting no attributes, by leaving every attribute parameter at EMPTY, produces a relation with no attributes. There are two such relations.)


The input relation consists of word forms annotated with sentence and token numbers and lemmas.

word tok sen lemma
on 1 3 olla
se 2 3 se
niin 3 3 niin
on 1 5 olla
ei 1 4 ei
ole 2 4 olla

The count attribute is named count. (The default name is cMcount.)

When the word form and lemma are kept, the two occurrences of olla as on melt into one record.

count lemma word
1 ei ei
1 se se
1 niin niin
2 olla on
1 olla ole

When only the lemma is kept, all three occurrences of olla melt into one record.

1 ei
1 se
3 olla
1 niin

Related tools

  • drop with count
  • keep
Search the Language Bank Portal:
Heidi Niva
Researcher of the Month: Heidi Niva


Upcoming events


The Language Bank's technical support:
kielipankki (at)
tel. +358 9 4572001

Requests related to language resources:
fin-clarin (at)
tel. +358 29 4129317

More contact information