[Seqan-dev] Occurrences the longest matched needle
- From: Alex <alex.lavoro.propio@gmail.com>
- To: seqan-dev@lists.fu-berlin.de
- Date: Thu, 22 Oct 2009 18:24:03 +0200
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=ias2a/kFkYRz3HxLaOEuvnJbAsqrQswgM3foyy3LWOAaGrDph8ysokSnachhxcrRme FNbjjPsW1j1ufAenWt/i4sj0CCQkJCLE4s/4uiRu+mrgv0M4EVlo5O619RPZD7hAd86r 7n9rsdlT9rz/sxSHqiYrc3R1z22VwHN0PX434=
- Reply-to: SeqAn Development <seqan-dev@lists.fu-berlin.de>
- Subject: [Seqan-dev] Occurrences the longest matched needle
I want to count the number of longest matched substring in a sequence.
For example,
typedef String<char> TSequence;
typedef StringSet<TSequence> TStringSet
TSequence haystack = "foo vino tinto bar";
StringSet<TSequence> needles;
appendValue(needles, "vino");
appendValue(needles, "vino tinto");
Finder<TSequence> finder(haystack);
Pattern<TStringSet, AhoCorasick> pattern(needles);
unsigned occurrences = 0;
while (find(finder, pattern))
occurrences ++;
In this case, occurrences is 2, since "vino" and "vino tinto" both
match the haystack. But I only want to count the occurrences of the
longest matches - "vino tinto".
I cannot remove the needle "vino" since I also want to match the
haystack "foo vino bar".