You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please describe the module you would like to add to bricks
Similar to the sentence complexity brick, however, this brick returns the highest sentence complexity that can be found.
Do you already have an implementation?
importtextstatATTRIBUTE: str="text"# only text attributesTARGET_LANGUAGE: str="en"# iso codesdefchunked_sentence_complexity(record):
complexities= [textstat.flesch_reading_ease(sent.text) forsentinrecord[ATTRIBUTE].sents]
returnget_mapping_complexity(min(complexities))
defget_mapping_complexity(score):
ifscore<30:
return"very difficult"ifscore<50:
return"difficult"ifscore<60:
return"fairly difficult"ifscore<70:
return"standard"ifscore<80:
return"fairly easy"ifscore<90:
return"easy"return"very easy"ifTARGET_LANGUAGEisnotNone:
textstat.set_lang(TARGET_LANGUAGE)
Additional context
Ironically, the most complex sentence be retrieved by using the min() function.
The text was updated successfully, but these errors were encountered:
Please describe the module you would like to add to bricks
Similar to the sentence complexity brick, however, this brick returns the highest sentence complexity that can be found.
Do you already have an implementation?
Additional context
Ironically, the most complex sentence be retrieved by using the
min()
function.The text was updated successfully, but these errors were encountered: