-
Notifications
You must be signed in to change notification settings - Fork 2
/
tag_getPlayerClass.m
34 lines (28 loc) · 1.08 KB
/
tag_getPlayerClass.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
function [ playerClass ] = tag_getPlayerClass( ocrTexts )
%TAG_GETPLAYERCLASS Returns sport class for given ocr texts
% Detailed explanation goes here
%% Load dbConfig
load(db_getDbConfigFileURI(), 'indexClassIntType', 'playerClasses', 'playerText_player_Map');
%% Set initial output vars
playerClass = 0;
playerClass = cast(playerClass, indexClassIntType);
msg = 'tag_getPlayerClass: ';
%% Start Finding Sport Class
playerTextKeys = playerText_player_Map.keys();
playerClassesFound = zeros(1, 50, indexClassIntType);
numClassesFound = 0;
for i = 1 : length(ocrTexts)
for j = 1 : length(playerTextKeys)
if(~isempty(strfind(ocrTexts{i}, upper(playerTextKeys{j}))))
numClassesFound = numClassesFound + 1;
playerClassesFound(numClassesFound) = playerText_player_Map(playerTextKeys{j});
end
end
end
%% Return sportClass
playerClassesFound = playerClassesFound(playerClassesFound>0);
temp = mode(playerClassesFound);
if ~isnan(temp)
playerClass = temp;
end
end