Giter Club home page Giter Club logo

tasi's Introduction

TASI

Data files naming conventions

  • Name-text.txt = raw text file
  • Name-GS.csv = hand annotated that is the Gold Standard to compare our model to, i.e. the "correct answers" to Anglicism identification
  • Name-TASI.csv = machine annotated file that is the output of our model

tasi's People

Contributors

koalachelsea avatar jserigos avatar

Watchers

 avatar

tasi's Issues

Recreate goldstandard

  • tokenization must be consistent with our model
  • remove problematic sentences
    -ensure all Anglicism Labels are True or False

Tokenization

Two modified tokenizers to consider

def custom_tokenizer(nlp):
infix_re = re.compile(r'''[,?;\‘\’`\“\”"'~]''')
modified_prefixes = tuple(x for x in nlp.Defaults.prefixes if x != '#')
prefix_re = compile_prefix_regex(modified_prefixes)
suffix_re = compile_suffix_regex(nlp.Defaults.suffixes)
is_candidate_filter = lambda token: token.pos_ in ["VERB", "NOUN", "ADJ"] and (token.is_stop == False) and (any(
{"@", "#"} & set(token.text)) == False)
Token.set_extension("is_candidate", getter=is_candidate_filter, force=True)
Token.set_extension("is_anglicism", default=False, force=True)
return Tokenizer(nlp.vocab, prefix_search=prefix_re.search,
suffix_search=suffix_re.search,
infix_finditer=infix_re.finditer,
token_match=None)

def custom_tokenizer_modified(nlp):
# spacy defaults: when the standard behaviour is required, they
# need to be included when subclassing the tokenizer
infix_re = re.compile(r'''[.,?!:;...\‘\’`\“\”"'~]''')
prefix_re = compile_prefix_regex(nlp.Defaults.prefixes)
suffix_re = compile_suffix_regex(nlp.Defaults.suffixes)

# extending the default url regex with regex for hashtags
hashtag_pattern = r'''|^(#[\w_-]+)$'''
url_and_hashtag = URL_PATTERN + hashtag_pattern
url_and_hashtag_re = re.compile(url_and_hashtag)

# set a custom extension to match if token is a hashtag
hashtag_getter = lambda token: token.text.startswith('#')
Token.set_extension('is_hashtag', getter=hashtag_getter)

return Tokenizer(nlp.vocab, prefix_search=prefix_re.search,
                 suffix_search=suffix_re.search,
                 infix_finditer=infix_re.finditer,
                 token_match=url_and_hashtag_re.match
                 )

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.