From cc870c139d513725c10fb847431aab1c754aa66f Mon Sep 17 00:00:00 2001 From: Coder731 Date: Thu, 14 Dec 2023 11:29:22 +0000 Subject: [PATCH] add referencer contains single file code and example BibTex bib reference file --- referencer/BibTex.bib | 17 ++ referencer/journalreferencer.py | 336 ++++++++++++++++++++++++++++++++ 2 files changed, 353 insertions(+) create mode 100644 referencer/BibTex.bib create mode 100644 referencer/journalreferencer.py diff --git a/referencer/BibTex.bib b/referencer/BibTex.bib new file mode 100644 index 0000000..a68b6b0 --- /dev/null +++ b/referencer/BibTex.bib @@ -0,0 +1,17 @@ +@article{KnieselGünter2001Jrbe, +journal = {Software, practice & experience}, +keywords = {access rights ; aliasing ; Computer Science ; Computer Science, Software Engineering ; encapsulation ; Java ; Science & Technology ; security ; Technology}, +language = {eng}, +number = {6}, +pages = {555-576}, +publisher = {John Wiley & Sons, Ltd}, +title = {JAC-Access right based encapsulation for Java}, +volume = {31}, +year = {2001}, +abstract = {Unwanted effects of aliasing cause encapsulation problems in object‐oriented programming. Nevertheless, aliasing is part of common and efficient programming techniques for expressing sharing of objects and as such its general restriction is not an option in practice. This paper proposes an approach that allows full referential object sharing but adds transitive access control to object references to limit the effects of aliasing. The approach relies on well‐known properties of object‐oriented type systems but exploits them in a novel way to support an access‐right‐based model of encapsulation. It is presented as an extension of Java, called JAC (Java with Access Control). Copyright © 2001 John Wiley & Sons, Ltd.}, +author = {Kniesel, Günter and Theisen, Dirk}, +address = {Chichester, UK}, +copyright = {Copyright © 2001 John Wiley & Sons, Ltd.}, +issn = {0038-0644}, +} + diff --git a/referencer/journalreferencer.py b/referencer/journalreferencer.py new file mode 100644 index 0000000..5093f89 --- /dev/null +++ b/referencer/journalreferencer.py @@ -0,0 +1,336 @@ +""" +This file calls: +- author +- journal + +function inside +file +for each +""" + +"""" +(CoderSales) + +https://github.com/CoderSales +""" + +""" +MIT License + +Copyright (c) 2023 Stephen + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +""" + +# ____________________________________ + +def author(): + """ + 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)): + starter=line + line=line.lstrip('author = {') + line=line.rstrip('},\n') + + endline=line + # print(endline) + return endline +# author=author() +# print(author) + +author=author() + +# ___________________________________ + +def year(): + """ + 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('^year',line)): + starter=line + line=line.lstrip('year = {') + line=line.rstrip('},\n') + + endline=line + # print(endline) + return endline + + +year=year() + +# __________________________________ + +def title(): + """ + 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('^title',line)): + starter=line + line=line.lstrip('title = {') + line=line.rstrip('},\n') + + endline=line + # print(endline) + return endline + +title=title() + +# __________________________________ + +def journal(): + """ + reads BibTex.bib file + outputs + journal name + """ + + + + # 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('^journal',line)): + starter=line + line=line.lstrip('journal = {') + line=line.rstrip('},\n') + + endline=line + # print(endline) + return endline + +journal=journal() + +# ___________________________________ + +def volume(): + """ + 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('^volume',line)): + starter=line + line=line.lstrip('volume = {') + line=line.rstrip('},\n') + + endline=line + # print(endline) + return endline + +volume=volume() + +# __________________________________ + +def number(): + """ + 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('^number',line)): + starter=line + line=line.lstrip('number = {') + line=line.rstrip('},\n') + + endline=line + # print(endline) + return endline + +number=number() + +# __________________________________ + +def pages(): + """ + 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('^pages',line)): + starter=line + line=line.lstrip('pages = {') + line=line.rstrip('},\n') + + endline=line + # print(endline) + return endline + +pages=pages() + +# __________________________________ + +def date(): + """ + get today's date + """ + + # Import date class from datetime module + from datetime import date + + # Returns the current local date + today = date.today() + # print("Today date is: ", today) + today=str(today) + return today + +date=date() + +# __________________________________ + +reference = author + ' (' + year + ') ' + '\'' + title + '\'' + ',' + ' ' + journal + ',' + ' ' + volume + '(' + number + ')' + ' ' + 'pp. ' + pages + ', ' + 'available: ' + '[accessed: ' + date + '].' + +print(reference)