Skip to content
Snippets Groups Projects
Commit 49fe7283 authored by Franck Dary's avatar Franck Dary
Browse files

Changed the way l_rules are computed

parent c43918ed
No related branches found
No related tags found
No related merge requests found
...@@ -150,6 +150,8 @@ int main(int argc, char * argv[]) ...@@ -150,6 +150,8 @@ int main(int argc, char * argv[])
char buffer[100000]; char buffer[100000];
std::map<std::string, std::vector<FPLM> > rules; std::map<std::string, std::vector<FPLM> > rules;
std::map<std::string, std::vector<FPLM> > acceptedRules;
while (fscanf(fplm.getDescriptor(), "%[^\n]\n", buffer) == 1) while (fscanf(fplm.getDescriptor(), "%[^\n]\n", buffer) == 1)
{ {
auto splited = util::split(buffer, '\t'); auto splited = util::split(buffer, '\t');
...@@ -180,7 +182,7 @@ int main(int argc, char * argv[]) ...@@ -180,7 +182,7 @@ int main(int argc, char * argv[])
{ {
if ((int)it.second.size() >= threshold) if ((int)it.second.size() >= threshold)
{ {
fprintf(rulesFile.getDescriptor(), "%s\n", it.first.c_str()); acceptedRules[it.first] = it.second;
for (auto & fplm : it.second) for (auto & fplm : it.second)
fpInRules[fplm.getFp()] = true; fpInRules[fplm.getFp()] = true;
} }
...@@ -189,11 +191,11 @@ int main(int argc, char * argv[]) ...@@ -189,11 +191,11 @@ int main(int argc, char * argv[])
exceptions[line.getFp()].emplace_back(line); exceptions[line.getFp()].emplace_back(line);
} }
for (auto & it : acceptedRules)
fprintf(rulesFile.getDescriptor(), "%s\n", it.first.c_str());
for (auto it : exceptions) for (auto it : exceptions)
{ {
if (fpInRules.count(it.first))
continue;
int indexMax = 0; int indexMax = 0;
int knownMax = 0; int knownMax = 0;
...@@ -204,6 +206,23 @@ int main(int argc, char * argv[]) ...@@ -204,6 +206,23 @@ int main(int argc, char * argv[])
knownMax = it.second[i].getNbKnown(); knownMax = it.second[i].getNbKnown();
} }
if (fpInRules.count(it.first))
{
int otherIndexMax = 0;
int otherKnownMax = 0;
for (unsigned int i = 0; i < acceptedRules[it.first].size(); i++)
if (acceptedRules[it.first][i].getNbKnown() > otherKnownMax)
{
otherIndexMax = i;
otherKnownMax = acceptedRules[it.first][i].getNbKnown();
}
if (otherKnownMax >= knownMax)
continue;
}
exceptionsToPrint.emplace_back(it.second[indexMax].toString()); exceptionsToPrint.emplace_back(it.second[indexMax].toString());
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment