-
Notifications
You must be signed in to change notification settings - Fork 2
/
tag_getTeamClass.m
43 lines (35 loc) · 1.39 KB
/
tag_getTeamClass.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
function [ teamClass ] = tag_getTeamClass( ocrTexts )
%TAG_GETTEAMCLASS Returns team class for given ocr texts
% Detailed explanation goes here
%% Load dbConfig
load(db_getDbConfigFileURI(), 'indexClassIntType', 'teamClasses', 'teamText_team_Map', 'playerText_team_Map');
%% Set initial output vars
teamClass = 0;
teamClass = cast(teamClass, indexClassIntType);
msg = 'tag_getTeamClass: ';
%% Start Finding Sport Class
teamTextKeys = teamText_team_Map.keys();
playerTextKeys = playerText_team_Map.keys();
teamClassesFound = zeros(1, 50, indexClassIntType);
numClassesFound = 0;
for i = 1 : length(ocrTexts)
for j = 1 : length(teamTextKeys)
if(~isempty(strfind(ocrTexts{i}, upper(teamTextKeys{j}))))
numClassesFound = numClassesFound + 1;
teamClassesFound(numClassesFound) = teamText_team_Map(teamTextKeys{j});
end
end
for j = 1 : length(playerTextKeys)
if(~isempty(strfind(ocrTexts{i}, upper(playerTextKeys{j}))))
numClassesFound = numClassesFound + 1;
teamClassesFound(numClassesFound) = playerText_team_Map(playerTextKeys{j});
end
end
end
%% Return sportClass
teamClassesFound = teamClassesFound(teamClassesFound>0);
temp = mode(teamClassesFound);
if ~isnan(temp)
teamClass = temp;
end
end