-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to take the ands out of the reference
or the option to leave ands in by commenting or uncommenting a line in main py search for the following comment can use either of the follwoing lines
- Loading branch information
1 parent
99145e8
commit 2438a57
Showing
3 changed files
with
112 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
|
||
|
||
import lines | ||
|
||
from lines import author | ||
|
||
author=author.author() | ||
|
||
# ___________________________________ | ||
def andReplacer(): | ||
""" | ||
encapsulate author program in a | ||
function | ||
""" | ||
# imports | ||
|
||
import nltk | ||
import re | ||
|
||
|
||
# file | ||
|
||
f_name="BibTex.bib" | ||
|
||
def opener(f_name): | ||
file = open(f_name, 'r', encoding="utf8") | ||
return file | ||
|
||
file=opener(f_name) | ||
|
||
# end prep | ||
|
||
endline='' | ||
file = opener(f_name) | ||
for line in file: | ||
if (re.search('^author',line)): | ||
# if (re.search(' and ',line)): | ||
starter=line | ||
line=line.lstrip('author = {') | ||
line=line.rstrip('},\n') | ||
|
||
# line=line.lstrip(' and ') | ||
# line=line.rstrip('') | ||
|
||
# splitter = re.compile(r'(\sand+|\Sand') | ||
lineList=re.split(' and ', line) | ||
# print(line2) | ||
# splitter = re.compile(r' and ') | ||
# splitter.findall(line) | ||
# print(line) | ||
# print(splitter) | ||
|
||
# for x in lineList: | ||
# lineList+=x | ||
# line=lineList | ||
|
||
# line=line.lstrip('[') | ||
# line=line.rstrip(']') | ||
|
||
line = re.sub(r', [][][^ ][azAZ] and ', ', ', line) | ||
# line = re.sub(r'[][^ ][azAZ] and ', ', ', line) | ||
line = re.sub(r' and ', ', ', line) | ||
endline=line | ||
|
||
# print(endline) | ||
|
||
|
||
|
||
# for x in lineList: | ||
# print(x) | ||
# lineList+=x | ||
# line2=lineList | ||
|
||
# return line2 | ||
|
||
# return type(endline[:]) | ||
return endline[:] | ||
|
||
|
||
# andReplacer=andReplacer() | ||
# print(andReplacer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# author and and Replacer | ||
|
||
```python | ||
import re | ||
splitter = re.compile(r'(\s+|\S+)') | ||
splitter.findall(s) | ||
``` | ||
|
||
[how to tokenizer split line delimiter python - Google Search](https://www.google.com/search?q=how+to+tokenizer+split+line+delimiter+python&oq=how+to+tokenizer+split+line+delimiter+python&gs_lcrp=EgZjaHJvbWUyCwgAEEUYChg5GKABMgkIARAhGAoYoAHSAQkxNDY1NGowajeoAgCwAgA&sourceid=chrome&ie=UTF-8) | ||
|
||
[tokenize a string keeping delimiters in Python - Stack Overflow](https://stackoverflow.com/questions/1820336/tokenize-a-string-keeping-delimiters-in-python) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters