Skip to content

Commit

Permalink
Bugfix: Pattern size and category constraints were not working for se…
Browse files Browse the repository at this point in the history
…veral methods #44
  • Loading branch information
proycon committed Feb 20, 2020
1 parent e705320 commit c260d65
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"@type": "SoftwareSourceCode",
"identifier": "colibricore",
"name": "Colibri Core",
"version": "2.5.1",
"version": "2.5.2",
"description": "Colibri core is an NLP tool as well as a C++ and Python library for working with basic linguistic constructions such as n-grams and skipgrams (i.e patterns with one or more gaps, either of fixed or dynamic size) in a quick and memory-efficient way. ",
"license": "https://spdx.org/licenses/GPL-3.0",
"url": "https://proycon.github.io/colibri-core",
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# $URL: https://ilk.uvt.nl/svn/sources/ucto/trunk/configure.ac $

AC_PREREQ([2.67])
AC_INIT([colibri-core],[2.5.1],[proycon@anaproy.nl])
AC_INIT([colibri-core],[2.5.2],[proycon@anaproy.nl])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADER([config.h])
Expand Down
24 changes: 12 additions & 12 deletions include/patternmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -3049,8 +3049,8 @@ class IndexedPatternModel: public PatternModel<IndexedData,IndexedDataHandler,Ma

if (((int) candidate.n() >= minsubsize) && (candidate != pattern)
&& ((occurrencethreshold == 0) || (this->occurrencecount(candidate) >= occurrencethreshold))
&& ((category == 0) || (candidate.category() >= category))
&& ((size == 0) || (candidate.n() >= size))
&& ((category == 0) || (candidate.category() == category))
&& ((size == 0) || (candidate.n() == size))
) {
if ((candidate.category() == SKIPGRAM) || (pattern.category() == SKIPGRAM)) {
//instance may not have skips in places where the larger candidate pattern does
Expand Down Expand Up @@ -3100,8 +3100,8 @@ class IndexedPatternModel: public PatternModel<IndexedData,IndexedDataHandler,Ma
const PatternPointer neighbour = iter2->second;
if ((ref2.token + neighbour.n() == ref.token)
&& ((occurrencethreshold == 0) || (this->occurrencecount(neighbour) >= occurrencethreshold))
&& ((category == 0) || (neighbour.category() >= category))
&& ((size == 0) || (neighbour.n() >= size))
&& ((category == 0) || (neighbour.category() == category))
&& ((size == 0) || (neighbour.n() == size))
){
neighbours[neighbour]++;
if ((cutoff > 0) && (neighbours.size() >= cutoff)) break;
Expand Down Expand Up @@ -3141,8 +3141,8 @@ class IndexedPatternModel: public PatternModel<IndexedData,IndexedDataHandler,Ma
for (std::unordered_set<PatternPointer>::iterator iter2 = rindex.begin(); iter2 != rindex.end(); iter2++) {
const PatternPointer neighbour = *iter2;
if ( ((occurrencethreshold == 0) || (this->occurrencecount(neighbour) >= occurrencethreshold))
&& ((category == 0) || (neighbour.category() >= category))
&& ((size == 0) || (neighbour.n() >= size)) ) {
&& ((category == 0) || (neighbour.category() == category))
&& ((size == 0) || (neighbour.n() == size)) ) {
neighbours[neighbour]++;
if ((cutoff > 0) && (neighbours.size() >= cutoff)) break;
}
Expand Down Expand Up @@ -3279,8 +3279,8 @@ class IndexedPatternModel: public PatternModel<IndexedData,IndexedDataHandler,Ma
const PatternPointer neighbour = iter2->second;
if ( (ref2.token > ref.token + _n)
&& ((occurrencethreshold == 0) || (this->occurrencecount(neighbour) >= occurrencethreshold))
&& ((category == 0) || (neighbour.category() >= category))
&& ((size == 0) || (neighbour.n() >= size))
&& ((category == 0) || (neighbour.category() == category))
&& ((size == 0) || (neighbour.n() == size))
) {
cooc[neighbour]++;
if (matches != NULL) matches->push_back(std::pair<IndexReference,IndexReference>(ref,ref2));
Expand Down Expand Up @@ -3322,8 +3322,8 @@ class IndexedPatternModel: public PatternModel<IndexedData,IndexedDataHandler,Ma
const int _n = neighbour.n();
if ( (ref2.token + _n < ref.token )
&& ((occurrencethreshold == 0) || (this->occurrencecount(neighbour) >= occurrencethreshold))
&& ((category == 0) || (neighbour.category() >= category))
&& ((size == 0) || (neighbour.n() >= size))
&& ((category == 0) || (neighbour.category() == category))
&& ((size == 0) || (neighbour.n() == size))
) {
cooc[neighbour]++;
}
Expand Down Expand Up @@ -3368,8 +3368,8 @@ class IndexedPatternModel: public PatternModel<IndexedData,IndexedDataHandler,Ma
const int _n2 = neighbour.n();
if ( ((ref2.token + _n2 < ref.token ) || (ref2.token > ref.token + _n))
&& ((occurrencethreshold == 0) || (this->occurrencecount(neighbour) >= occurrencethreshold))
&& ((category == 0) || (neighbour.category() >= category))
&& ((size == 0) || (neighbour.n() >= size))
&& ((category == 0) || (neighbour.category() == category))
&& ((size == 0) || (neighbour.n() == size))
) {
cooc[neighbour]++;
}
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def read(fname):
license = "GPL",
keywords = "nlp computational_linguistics frequency ngram skipgram pmi cooccurrence linguistics",
long_description=read('README.rst'),
version = '2.5.1',
version = '2.5.2',
ext_modules = extensions,
cmdclass = {'build_ext': build_ext},
classifiers=[
Expand Down

0 comments on commit c260d65

Please sign in to comment.