mirror of https://gitlab.com/bashrc2/epicyon
Remove dashes when matching words
parent
7d7da68931
commit
8b3f2ce0d4
|
@ -434,11 +434,11 @@
|
||||||
{
|
{
|
||||||
"@value": "Sari",
|
"@value": "Sari",
|
||||||
"@language": "de"
|
"@language": "de"
|
||||||
}
|
},
|
||||||
{
|
{
|
||||||
"@value": "Sari",
|
"@value": "Sari",
|
||||||
"@language": "es"
|
"@language": "es"
|
||||||
}
|
},
|
||||||
{
|
{
|
||||||
"@value": "Sari",
|
"@value": "Sari",
|
||||||
"@language": "en"
|
"@language": "en"
|
||||||
|
|
|
@ -57,12 +57,16 @@ def _loadDfcIds(baseDir: str, systemLanguage: str,
|
||||||
baseDir + '/ontology/' + productType + 'Types.json'
|
baseDir + '/ontology/' + productType + 'Types.json'
|
||||||
productTypes = loadJson(productTypesFilename)
|
productTypes = loadJson(productTypesFilename)
|
||||||
if not productTypes:
|
if not productTypes:
|
||||||
|
print('Unable to load ontology: ' + productTypesFilename)
|
||||||
return None
|
return None
|
||||||
if not productTypes.get('@graph'):
|
if not productTypes.get('@graph'):
|
||||||
|
print('No @graph list within ontology')
|
||||||
return None
|
return None
|
||||||
if len(productTypes['@graph']) == 0:
|
if len(productTypes['@graph']) == 0:
|
||||||
|
print('@graph list has no contents')
|
||||||
return None
|
return None
|
||||||
if not productTypes['@graph'][0].get('rdfs:label'):
|
if not productTypes['@graph'][0].get('rdfs:label'):
|
||||||
|
print('@graph list entry has no rdfs:label')
|
||||||
return None
|
return None
|
||||||
languageExists = False
|
languageExists = False
|
||||||
for label in productTypes['@graph'][0]['rdfs:label']:
|
for label in productTypes['@graph'][0]['rdfs:label']:
|
||||||
|
@ -211,6 +215,7 @@ def _getshareDfcId(baseDir: str, systemLanguage: str,
|
||||||
# bag of words match
|
# bag of words match
|
||||||
maxMatchedWords = 0
|
maxMatchedWords = 0
|
||||||
for name, uri in dfcIds.items():
|
for name, uri in dfcIds.items():
|
||||||
|
name = name.replace('-', ' ')
|
||||||
words = name.split(' ')
|
words = name.split(' ')
|
||||||
score = 0
|
score = 0
|
||||||
for wrd in words:
|
for wrd in words:
|
||||||
|
|
5
tests.py
5
tests.py
|
@ -1490,6 +1490,10 @@ def testSharedItemsFederation():
|
||||||
bobDir + '/ontology/toolTypes.json')
|
bobDir + '/ontology/toolTypes.json')
|
||||||
copyfile(baseDir + '/ontology/clothesTypes.json',
|
copyfile(baseDir + '/ontology/clothesTypes.json',
|
||||||
bobDir + '/ontology/clothesTypes.json')
|
bobDir + '/ontology/clothesTypes.json')
|
||||||
|
assert os.path.isfile(bobDir + '/logo.png')
|
||||||
|
assert os.path.isfile(bobDir + '/ontology/foodTypes.json')
|
||||||
|
assert os.path.isfile(bobDir + '/ontology/toolTypes.json')
|
||||||
|
assert os.path.isfile(bobDir + '/ontology/clothesTypes.json')
|
||||||
sessionBob = createSession(proxyType)
|
sessionBob = createSession(proxyType)
|
||||||
sharedItemName = 'cheddar'
|
sharedItemName = 'cheddar'
|
||||||
sharedItemDescription = 'Some cheese'
|
sharedItemDescription = 'Some cheese'
|
||||||
|
@ -1573,6 +1577,7 @@ def testSharedItemsFederation():
|
||||||
assert len(sharesJson.items()) == 3
|
assert len(sharesJson.items()) == 3
|
||||||
for itemID, item in sharesJson.items():
|
for itemID, item in sharesJson.items():
|
||||||
if not item.get('dfcId'):
|
if not item.get('dfcId'):
|
||||||
|
pprint(item)
|
||||||
print(itemID + ' does not have dfcId field')
|
print(itemID + ' does not have dfcId field')
|
||||||
assert item.get('dfcId')
|
assert item.get('dfcId')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue