Lexitron 2.0.2__tar.gz → 2.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Lexitron
3
- Version: 2.0.2
3
+ Version: 2.0.4
4
4
  Summary: A command-line regex search engine for the English language
5
5
  Home-page: http://github.com/rothos/lexitron
6
6
  Author: Rothos
@@ -59,12 +59,17 @@ where `expression` is a regular expression and `[options]` are as follows.
59
59
  --------|-------------------------------------------------
60
60
  `-d` | Append start and end delimiters `^...$` to search query
61
61
  `-n` | Print only the number of matches
62
- `-u` | Search only for common/lowercase/non-capitalized words
63
- `-U` | Search only for proper/uppercase/capitalized words
62
+ `-u` | Search only for lowercase/common/uncapitalized words
63
+ `-U` | Search only for uppercase/proper/capitalized words
64
+ `-v` | Show version and exit
64
65
  `-x` | Print unformatted output, one word per line
65
66
 
66
67
  Type `$ lx -h` for full help text.
67
68
 
69
+ If you aren't familiar with regular expressions, it isn't too hard to learn
70
+ the basics. There are many resources online. A good starting point is
71
+ the [Wikipedia article](https://en.wikipedia.org/wiki/Regular_expression).
72
+
68
73
 
69
74
  Output
70
75
  ------------------------------------------------------------------------------
@@ -72,7 +77,7 @@ By default, Lexitron will output a well-formatted (potentially multi-column)
72
77
  list of words, along with a header describing the results.
73
78
 
74
79
  The results are separated into "proper" words (capitalized, like "France")
75
- and "common" words (lowercase, like "banana").
80
+ and "common" words (lowercase, like "boat").
76
81
 
77
82
  Using the `-x` flag will return a more machine-readable output with one word
78
83
  per line.
@@ -170,7 +175,7 @@ hallalling parallelling scuttlebutt yellowbelly
170
175
  ```
171
176
 
172
177
  ### Example 5
173
- Compare the number of lowercase/non-capitalized words that end in "woman"
178
+ Compare the number of lowercase/uncapitalized words that end in "woman"
174
179
  with the number that end in "man".
175
180
  ```
176
181
  $ lx -nxu ".*woman"
@@ -5,11 +5,7 @@ setup.cfg
5
5
  ./lexitron/__init__.py
6
6
  ./lexitron/agid-common.txt
7
7
  ./lexitron/agid-proper.txt
8
- ./lexitron/dict_util.py
9
8
  ./lexitron/lexitron.py
10
- ./lexitron/words-lower.txt
11
- ./lexitron/words-upper.txt
12
- ./lexitron/words.txt
13
9
  Lexitron.egg-info/PKG-INFO
14
10
  Lexitron.egg-info/SOURCES.txt
15
11
  Lexitron.egg-info/dependency_links.txt
@@ -0,0 +1,4 @@
1
+
2
+ [:python_version < "3.8"]
3
+ importlib-metadata
4
+ importlib-resources
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Lexitron
3
- Version: 2.0.2
3
+ Version: 2.0.4
4
4
  Summary: A command-line regex search engine for the English language
5
5
  Home-page: http://github.com/rothos/lexitron
6
6
  Author: Rothos
@@ -59,12 +59,17 @@ where `expression` is a regular expression and `[options]` are as follows.
59
59
  --------|-------------------------------------------------
60
60
  `-d` | Append start and end delimiters `^...$` to search query
61
61
  `-n` | Print only the number of matches
62
- `-u` | Search only for common/lowercase/non-capitalized words
63
- `-U` | Search only for proper/uppercase/capitalized words
62
+ `-u` | Search only for lowercase/common/uncapitalized words
63
+ `-U` | Search only for uppercase/proper/capitalized words
64
+ `-v` | Show version and exit
64
65
  `-x` | Print unformatted output, one word per line
65
66
 
66
67
  Type `$ lx -h` for full help text.
67
68
 
69
+ If you aren't familiar with regular expressions, it isn't too hard to learn
70
+ the basics. There are many resources online. A good starting point is
71
+ the [Wikipedia article](https://en.wikipedia.org/wiki/Regular_expression).
72
+
68
73
 
69
74
  Output
70
75
  ------------------------------------------------------------------------------
@@ -72,7 +77,7 @@ By default, Lexitron will output a well-formatted (potentially multi-column)
72
77
  list of words, along with a header describing the results.
73
78
 
74
79
  The results are separated into "proper" words (capitalized, like "France")
75
- and "common" words (lowercase, like "banana").
80
+ and "common" words (lowercase, like "boat").
76
81
 
77
82
  Using the `-x` flag will return a more machine-readable output with one word
78
83
  per line.
@@ -170,7 +175,7 @@ hallalling parallelling scuttlebutt yellowbelly
170
175
  ```
171
176
 
172
177
  ### Example 5
173
- Compare the number of lowercase/non-capitalized words that end in "woman"
178
+ Compare the number of lowercase/uncapitalized words that end in "woman"
174
179
  with the number that end in "man".
175
180
  ```
176
181
  $ lx -nxu ".*woman"
@@ -46,12 +46,17 @@ where `expression` is a regular expression and `[options]` are as follows.
46
46
  --------|-------------------------------------------------
47
47
  `-d` | Append start and end delimiters `^...$` to search query
48
48
  `-n` | Print only the number of matches
49
- `-u` | Search only for common/lowercase/non-capitalized words
50
- `-U` | Search only for proper/uppercase/capitalized words
49
+ `-u` | Search only for lowercase/common/uncapitalized words
50
+ `-U` | Search only for uppercase/proper/capitalized words
51
+ `-v` | Show version and exit
51
52
  `-x` | Print unformatted output, one word per line
52
53
 
53
54
  Type `$ lx -h` for full help text.
54
55
 
56
+ If you aren't familiar with regular expressions, it isn't too hard to learn
57
+ the basics. There are many resources online. A good starting point is
58
+ the [Wikipedia article](https://en.wikipedia.org/wiki/Regular_expression).
59
+
55
60
 
56
61
  Output
57
62
  ------------------------------------------------------------------------------
@@ -59,7 +64,7 @@ By default, Lexitron will output a well-formatted (potentially multi-column)
59
64
  list of words, along with a header describing the results.
60
65
 
61
66
  The results are separated into "proper" words (capitalized, like "France")
62
- and "common" words (lowercase, like "banana").
67
+ and "common" words (lowercase, like "boat").
63
68
 
64
69
  Using the `-x` flag will return a more machine-readable output with one word
65
70
  per line.
@@ -157,7 +162,7 @@ hallalling parallelling scuttlebutt yellowbelly
157
162
  ```
158
163
 
159
164
  ### Example 5
160
- Compare the number of lowercase/non-capitalized words that end in "woman"
165
+ Compare the number of lowercase/uncapitalized words that end in "woman"
161
166
  with the number that end in "man".
162
167
  ```
163
168
  $ lx -nxu ".*woman"
@@ -1,5 +1,5 @@
1
1
  import sys, os, re, argparse
2
- from importlib import resources
2
+ from importlib import resources, metadata
3
3
  from math import ceil, floor
4
4
 
5
5
  class Lexitron:
@@ -33,19 +33,19 @@ class Lexitron:
33
33
  # self.parser.add_argument('-a',
34
34
  # dest='all', action='store_true',
35
35
  # help='Search all words, including plurals and conjugations')
36
- self.parser.add_argument('-d',
37
- dest='delimiters', action='store_true',
38
- help='Append start and end delimiters ^...$ to search query')
39
- self.parser.add_argument('-n',
36
+ self.parser.add_argument('-n', '--number-only',
40
37
  dest='number', action='store_true',
41
38
  help='Print only the number of matches')
42
- self.parser.add_argument('-u',
39
+ self.parser.add_argument('-u', '--lowercase',
43
40
  dest='only_common', action='store_true',
44
- help='Search only for common/lowercase/non-capitalized words')
45
- self.parser.add_argument('-U',
41
+ help='Search only for lowercase/common/uncapitalized words (like "boat")')
42
+ self.parser.add_argument('-U', '--uppercase',
46
43
  dest='only_proper', action='store_true',
47
- help='Search only for proper/uppercase/capitalized words')
48
- self.parser.add_argument('-x',
44
+ help='Search only for uppercase/proper/capitalized words (like "France")')
45
+ self.parser.add_argument('-v', '--version',
46
+ action='version', version="Lexitron "+metadata.version('lexitron'),
47
+ help='Show version and exit')
48
+ self.parser.add_argument('-x', '--plain',
49
49
  dest='unformatted', action='store_true',
50
50
  help='Print unformatted output, one word per line')
51
51
 
@@ -66,8 +66,6 @@ class Lexitron:
66
66
 
67
67
  # Get the expression ready.
68
68
  expr = self.sanitize(args.expression)
69
- if args.delimiters:
70
- expr = '^' + expr + '$'
71
69
 
72
70
  # Currently, lexitron search is case-insensitive.
73
71
  expr = re.compile(expr, flags=re.IGNORECASE)
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = Lexitron
3
- version = 2.0.2
3
+ version = 2.0.4
4
4
  author = Rothos
5
5
  url = http://github.com/rothos/lexitron
6
6
  description = A command-line regex search engine for the English language
@@ -17,7 +17,8 @@ include_package_data = True
17
17
  packages = find:
18
18
  python_requires = >=3.7
19
19
  install_requires =
20
- importlib-metadata
20
+ importlib-metadata;python_version<'3.8'
21
+ importlib-resources;python_version<'3.8'
21
22
  package_dir =
22
23
  = .
23
24
 
@@ -1 +0,0 @@
1
- importlib-metadata
@@ -1,47 +0,0 @@
1
- # This python script is a utility to separate large dictionary files
2
- # into lowercase and uppercase (common and proper) parts.
3
- # These parts are written to two new files.
4
-
5
- import sys
6
- from importlib import resources
7
-
8
- dictfile = 'words.txt'
9
- with open(dictfile, 'rb') as f:
10
- words = f.read()
11
- f.close()
12
-
13
- words = words.splitlines()
14
- words = [word.decode('utf-8') for word in words]
15
-
16
- lowercase = []
17
- uppercase = []
18
-
19
- for word in words:
20
- word = word.strip()
21
-
22
- # If there is any punctuation in the word, skip it
23
- if not word.isalpha():
24
- continue
25
-
26
- if word[0].islower():
27
- lowercase.append(word)
28
-
29
- elif word[0].isupper():
30
- uppercase.append(word)
31
-
32
- else:
33
- print("Error: {} is neither lowercase nor uppercase".format(word))
34
-
35
- lowercase = [word for word in lowercase]
36
- uppercase = [word for word in uppercase]
37
-
38
- lowercase_file = 'words-lower.txt'
39
- uppercase_file = 'words-upper.txt'
40
-
41
- with open(lowercase_file, 'w') as f:
42
- f.write("\n".join(lowercase))
43
- f.close()
44
-
45
- with open(uppercase_file, 'w') as f:
46
- f.write("\n".join(uppercase))
47
- f.close()