Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dcs_classifier
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
dcs_classifier
Commits
048d14a9
Commit
048d14a9
authored
Aug 06, 2015
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix subkey substring elemination logic for negative subkeys
This fixes compilation for key sogou*!sogoumobilebrowser
parent
15473c01
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
10 deletions
+57
-10
gen_dcs_classifier.pl
src/gen/gen_dcs_classifier.pl
+57
-10
No files found.
src/gen/gen_dcs_classifier.pl
View file @
048d14a9
...
...
@@ -653,6 +653,13 @@ use constant {
MAX_COMMON_SUBKEYS
=>
32
,
};
use
constant
{
SKSS_KEY
=>
0
,
SKSS_STR
=>
1
,
# key without optional !
SKSS_LEN
=>
2
,
SKSS_NEG
=>
3
};
my
%
manual
_fixup_remove
=
(
'android 4.0'
=>
1
,
);
...
...
@@ -731,20 +738,60 @@ for (my $i = 0; $i <= $#dbrefs; $i++) {
$key
=
lc
(
$key
);
# remove any subkey which is wholly contained in another subkey
# sort reverse by length, only remove shorter ones
# remove any subkey which is wholly contained in another
# subkey. Depending on which key is positive / negative,
# we remove the redundant one
#
# long | short
# ------------
# pos pos remove short
# pos neg remove long
# neg pos keep
# neg neg remove long
my
@sks
;
{
my
@skss
=
(
sort
{
length
(
$b
)
<=>
length
(
$a
)
}
split
(
/\*/
,
$key
));
my
@skss
=
sort
{
$b
->
[
SKSS_LEN
]
<=>
$a
->
[
SKSS_LEN
]
}
map
{
my
@ee
;
$ee
[
SKSS_KEY
]
=
$_
;
if
(
substr
(
$_
,
0
,
1
)
eq
"!"
)
{
$ee
[
SKSS_STR
]
=
substr
(
$ee
[
SKSS_KEY
],
1
);
$ee
[
SKSS_NEG
]
=
1
;
}
else
{
$ee
[
SKSS_STR
]
=
$ee
[
SKSS_KEY
];
$ee
[
SKSS_NEG
]
=
0
;
}
$ee
[
SKSS_LEN
]
=
length
(
$ee
[
SKSS_STR
]);
\
@ee
;
}
split
(
/\*/
,
$key
);
skss:
for
(
my
$i
=
0
;
$i
<=
$#skss
;
$i
++
)
{
for
(
my
$j
=
0
;
$j
<=
$#sks
;
$j
++
)
{
if
(
index
(
$sks
[
$j
],
$skss
[
$i
])
!=
-
1
)
{
next
skss
;
next
skss
unless
(
defined
(
$skss
[
$i
]));
for
(
my
$j
=
$i
+
1
;
$j
<=
$#skss
;
$j
++
)
{
next
unless
(
defined
(
$skss
[
$j
]));
if
(
index
(
$skss
[
$i
]
->
[
SKSS_STR
],
$skss
[
$j
]
->
[
SKSS_STR
])
!=
-
1
)
{
# j contained in i
if
(
$skss
[
$j
]
->
[
SKSS_NEG
])
{
# remove long == skip adding i
next
skss
;
}
if
(
$skss
[
$i
]
->
[
SKSS_NEG
])
{
# long neg short pos - keep
}
else
{
# long pos short pos - remove short
undef
(
$skss
[
$j
]);
}
}
}
push
@sks
,
(
$skss
[
$i
]);
$subkeys_count
{
$skss
[
$i
]}
++
;
push
@sks
,
(
$skss
[
$i
]
->
[
SKSS_KEY
]
);
$subkeys_count
{
$skss
[
$i
]
->
[
SKSS_KEY
]
}
++
;
}
}
...
...
@@ -855,8 +902,8 @@ sub process_entry($) {
if
(
scalar
(
keys
%
sks_positive
)
==
0
)
{
my
@common
=
keys
%
sks_common
;
die
'neither positive nor common subkeys for key '
.
$
{
$entry
->
[
ENTRY_KEY
]}
unless
(
scalar
(
@common
)
>
0
);
die
'neither positive nor common subkeys for key '
.
$
{
$entry
->
[
ENTRY_KEY
]}
unless
(
scalar
(
@common
)
>
0
);
# choose the common subkey with the lowest count
# (which is the one with the highest value)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment