Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

documentation includes stats-service commands but doesn't say how to make stats-service interoperate #159

Open
jonorthwash opened this issue Jul 2, 2020 · 6 comments
Labels

Comments

@jonorthwash
Copy link
Member

At least it seems "calcCoverage" listed at https://wiki.apertium.org/wiki/Apertium-apy#Usage is not standard with APy?

@jonorthwash
Copy link
Member Author

@Ryu945

@Ryu945
Copy link

Ryu945 commented Jul 5, 2020

Apparently /calcCoverage has nothing to do with stat service github like some people thought.

apertium/apertium-stats-service#69

Does anyone know anything about how to use /calcCoverage?

@jonorthwash
Copy link
Member Author

@sushain97, can you help?

@sushain97
Copy link
Member

It's very basic:

def get_coverage(text, mode, mode_dir, penalize=False):
analysis = yield apertium(text, mode, mode_dir)
lexical_units = remove_dot_from_deformat(text, re.findall(r'\^([^\$]*)\$([^\^]*)', analysis))
analyzed_lexical_units = list(filter(lambda x: not x[0].split('/')[1][0] in '*&#', lexical_units))
if len(lexical_units) and not penalize:
return len(analyzed_lexical_units) / len(lexical_units)
elif len(lexical_units) and len(text) and penalize:
return len(analyzed_lexical_units) / len(lexical_units) - (1 - sum([len(lu[0].split('/')[0]) for lu in lexical_units]) / len(text))
else:
return -1
. It looks like all it does is look for how many lexical units we were able to analyze.

@sushain97
Copy link
Member

sushain97 commented Jul 9, 2020

documentation includes stats-service commands

where? I don't see any references to stats-service

@jonorthwash
Copy link
Member Author

Aha, this is coverage of text that it's sent. There's an example on the wiki, @Ryu945 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants