Browse Source

leaf strategy tester

Nikos Atlas 2 years ago
parent
commit
a6c1829963
4 changed files with 58 additions and 1 deletions
  1. 18 0
      __tests__/test_leaf_strategy.py
  2. 1 1
      document.txt
  3. 9 0
      src/strategies/leaf_strategy.py
  4. 30 0
      src/utils/word_helpers.py

+ 18 - 0
__tests__/test_leaf_strategy.py

@@ -0,0 +1,18 @@
+import pytest
+
+import spacy
+from spacy import displacy
+
+# import here your file
+
+nlp = spacy.load("en_core_web_trf")
+
[email protected]('text, expected', [
+    ('Regex for redacted phone numbers with extra info for PlayStation', ['PhoneNumberRegex', 'RedactedPhoneNumberRegex'])
+])
+def test_leaf_strategy(text, expected):
+    doc = nlp(text)
+
+    # result = leaf_strategy(doc)
+
+    # assert result == expected

+ 1 - 1
document.txt

@@ -6,7 +6,7 @@
 static escape(text: string): string
 
 /**
- * Regex for redacted phone numbers with extra info for Baan-kaidee (TO BE REMOVED).
+ * Regex for redacted phone numbers with extra info for PlayStation (TO BE REMOVED).
  */
 const PHONE_PLACEHOLDER_NUMBER: RegExp = /\[redacted phone number\](#{0,1}\(([()_\-+\d ]*)\)){0,1}/;
 

+ 9 - 0
src/strategies/leaf_strategy.py

@@ -0,0 +1,9 @@
+def leaf_strategy(doc):
+    """
+    Should return an arrays of variable names based on leaf strategy
+
+    :param doc: spacy document
+    :return Array of strings
+    """
+
+    pass

+ 30 - 0
src/utils/word_helpers.py

@@ -0,0 +1,30 @@
+def camel_case(word):
+    pass
+
+
+def upper_case(word):
+    pass
+
+
+def snake_case(word):
+    pass
+
+
+def constants(word):
+    return upper_case(snake_case(word))
+
+
+def variable(word):
+    pass
+
+
+def function(word):
+    pass
+
+
+def classname(word):
+    pass
+
+
+def method(word):
+    pass