File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22 "cells" : [
33 {
44 "cell_type" : " markdown" ,
5- "id" : " 22430569 " ,
5+ "id" : " 77dd4a9b " ,
66 "metadata" : {},
77 "source" : [
88 " ## POSNoise"
99 ]
1010 },
1111 {
1212 "cell_type" : " code" ,
13- "execution_count" : 2 ,
14- "id" : " a6e994f3 " ,
13+ "execution_count" : 1 ,
14+ "id" : " 381f1f4b " ,
1515 "metadata" : {},
16- "outputs" : [],
16+ "outputs" : [
17+ {
18+ "name" : " stdout" ,
19+ "output_type" : " stream" ,
20+ "text" : [
21+ " [POSNoise] Loading spaCy model 'en_core_web_sm' (disabled: parser, ner)...\n " ,
22+ " [POSNoise] Loaded 'en_core_web_sm'.\n " ,
23+ " The original dataset contains two partitions comprising sockpuppets and non-sockpuppets cases.\n " ,
24+ " The @ # Ø two # Ø # and @@@ #.\n "
25+ ]
26+ }
27+ ],
1728 "source" : [
1829 " import posnoise\n " ,
1930 " from posnoise import POSNoise"
2031 ]
2132 },
2233 {
2334 "cell_type" : " code" ,
24- "execution_count" : 5 ,
25- "id" : " 5f770232 " ,
35+ "execution_count" : 2 ,
36+ "id" : " a54b16a6 " ,
2637 "metadata" : {},
2738 "outputs" : [],
2839 "source" : [
3142 },
3243 {
3344 "cell_type" : " code" ,
34- "execution_count" : 6 ,
35- "id" : " 130a1ee7 " ,
45+ "execution_count" : 4 ,
46+ "id" : " 6febdb03 " ,
3647 "metadata" : {
3748 "scrolled" : true
3849 },
4152 "name" : " stdout" ,
4253 "output_type" : " stream" ,
4354 "text" : [
44- " Mathematics is the most beautiful and most powerful creation of the human spirit. \n " ,
45- " # is the most @ and most @ # of the @ #. \n "
55+ " I love python ! \n " ,
56+ " I Ø # ! \n "
4657 ]
4758 }
4859 ],
4960 "source" : [
50- " document = \" Mathematics is the most beautiful and most powerful creation of the human spirit.\"\n " ,
61+ " #document = \" Mathematics is the most beautiful and most powerful creation of the human spirit.\"\n " ,
62+ " \n " ,
63+ " document = \" I love python !\"\n " ,
5164 " posnoised_doc = posnoise_instance.pos_noise(document)\n " ,
5265 " \n " ,
5366 " print(document)\n " ,
5770 {
5871 "cell_type" : " code" ,
5972 "execution_count" : null ,
60- "id" : " 41ceb46c " ,
73+ "id" : " 69bf62a8 " ,
6174 "metadata" : {},
6275 "outputs" : [],
6376 "source" : []
Original file line number Diff line number Diff line change @@ -296,10 +296,3 @@ def pos_noise(self, text: str) -> str:
296296 text = text [: token .idx ] + replace_token + text [token .idx + len (token .text ) :]
297297 return text
298298
299-
300-
301- posnoise = POSNoise (spacy_model_size = SpacyModelSize .Small , verbose = True )
302- document = "The original dataset contains two partitions comprising sockpuppets and non-sockpuppets cases."
303- posnoised_doc = posnoise .pos_noise (document )
304- print (document )
305- print (posnoised_doc )
Original file line number Diff line number Diff line change @@ -21,9 +21,9 @@ class TestPOSNoise(unittest.TestCase):
2121
2222 def test_posnoise_masking_1_large_model (self ):
2323 posnoise_instance = POSNoise (spacy_model_size = posnoise .SpacyModelSize .Large )
24- document = "Mathematics is the most beautiful and most powerful creation of the human spirit. "
24+ document = "I love python ! "
2525 posnoised_doc = posnoise_instance .pos_noise (document )
2626
27- assert posnoised_doc == "# is the most @ and most @ # of the @ #. "
27+ assert posnoised_doc == "I Ø # ! "
2828
2929
You can’t perform that action at this time.
0 commit comments