From 1e61b3583942902a326a968a1dc37ee32c8df2c4 Mon Sep 17 00:00:00 2001 From: YashGangwar Date: Sun, 27 Oct 2019 01:44:24 +0530 Subject: [PATCH 1/2] Added readerView python --- .../__pycache__/readerView.cpython-35.pyc | Bin 0 -> 838 bytes ReaderView/Parsing/readerView.py | 27 +++++++++++ ReaderView/README.md | 32 +++++++++++++ ReaderView/apiMaster.py | 42 ++++++++++++++++++ ReaderView/templates/reader.html | 16 +++++++ 5 files changed, 117 insertions(+) create mode 100644 ReaderView/Parsing/__pycache__/readerView.cpython-35.pyc create mode 100644 ReaderView/Parsing/readerView.py create mode 100644 ReaderView/README.md create mode 100644 ReaderView/apiMaster.py create mode 100644 ReaderView/templates/reader.html diff --git a/ReaderView/Parsing/__pycache__/readerView.cpython-35.pyc b/ReaderView/Parsing/__pycache__/readerView.cpython-35.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8d3fc60d74b7d5d445dd6d1a7067764fb79eaaae GIT binary patch literal 838 zcmYjPy^hmB5T5nFog73INHnJ_h;%8A2S5lN3MD$7gaBa~Sx$DzIq{!%Hw2JV9VIV9 zi+B>sEuf&{6{wi8eUKf`?ELLFv$MW?bQJyg`Ss0x8{iilEDQB>WOagqg{I z7`K4i@ChJB#ewHD_cvz2j2Zul)cLXyOGXY{5%MkMIkFm~R|B*F*9`UyS_W$d*8q$( z>z`)B-s*x5>}_amYG4zByd-_?QZoeLK;;4Uf(o5Sy-%wKv%-TIbvx6)iGCi;A?kq+ zI!{QLc&&{C^4s7+^WKo>cdqCL<@;a`(SYXA;xw=rR`Q^Afa4MD3DGecLW_Mzbobnc zJ(?lTZFKQ5nDVpf;%xfbfTW=rSLeDA#>=+)s+Pv#nHI*;;=ML*US=y{MqH?+%p0B8 zm9e+7n2jX8R~+zqR~2=}joV~W3F(k`+-w&`uC7u-iUXzPTb-98o|Hmo=>eAXslHu^ zD)#&8Dh_qsq+QurB z*qurgUu9MDRHzM>!Tp^m>ZTNxPF{({$y{c;Ldaw}?3Z|_yjmqa+RI$*9yA}!s5jHK zsw=v$Iz<6&%p#-^Y0U0e9y>-lWyh%fr?Dj`n0qm^ 0 else "" + image = article.top_image if article.top_image is not None else "" + reader = { + "title": title, + "author": author, + "date": date, + "text": text, + "image": image, + "description": desc, + "url": url + } + return reader \ No newline at end of file diff --git a/ReaderView/README.md b/ReaderView/README.md new file mode 100644 index 0000000..9308ba9 --- /dev/null +++ b/ReaderView/README.md @@ -0,0 +1,32 @@ +# Reader View + +## INSTALLATIONS +Install newspaper module in python 3.5 +``` +pip3 install newspaper3k +``` +Install requests module +``` +pip install requests +``` +Install Regular Expressions module +``` +pip install regex +``` +Install Natural Language Toolkit module +``` +pip install nltk +``` + +For api calls, run the apiMaster.py module for local calls: +``` +python apiMaster.py +``` +## USAGE + +Goto: +``` +http://localhost:5000/readerView/?url=&ret= +``` +Returns a JSON object if ret = json +Returns a html page if ret = html \ No newline at end of file diff --git a/ReaderView/apiMaster.py b/ReaderView/apiMaster.py new file mode 100644 index 0000000..10ec257 --- /dev/null +++ b/ReaderView/apiMaster.py @@ -0,0 +1,42 @@ +import Parsing.readerView + +from flask import Flask, request, render_template +from flask_restful import Api + +app = Flask(__name__) +api = Api(app) + + +@app.route('/') +def showpaths(): + paths = "Use path /readerView/" + return paths + + +@app.route('/readerView/') +def getreader(): + if 'url' in request.args: + if 'ret' in request.args: + if request.args['ret'] == 'json': + return Parsing.readerView.reader_json(request.args['url']) + elif request.args['ret'] == 'html': + value = Parsing.readerView.reader_json(request.args['url']) + return render_template('reader.html', + title=value['title'], + author=value['author'], + date=value['date'], + text=value['text'], + image=value['image'], + description=value['description'], + url=value['url'] + ) + else: + return 'ret = html or json' + else: + return 'Provide return type ret' + else: + return 'Provide url in query' + + +if __name__ == '__main__': + app.run() diff --git a/ReaderView/templates/reader.html b/ReaderView/templates/reader.html new file mode 100644 index 0000000..40cef7b --- /dev/null +++ b/ReaderView/templates/reader.html @@ -0,0 +1,16 @@ + + + + {{ title }} + + +

{{ title }}

+

{{ description }}

+
{{ date }} {{ author }}
+
+ + {{ text }} +

+

For the complete article, Click here.

+ + \ No newline at end of file From 2457a148e6e96f4706526e028192633412519256 Mon Sep 17 00:00:00 2001 From: YashGangwar Date: Thu, 31 Oct 2019 23:09:06 +0530 Subject: [PATCH 2/2] Add linear search in Searching. --- Searching/LinearSearch.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Searching/LinearSearch.cpp diff --git a/Searching/LinearSearch.cpp b/Searching/LinearSearch.cpp new file mode 100644 index 0000000..7d18ded --- /dev/null +++ b/Searching/LinearSearch.cpp @@ -0,0 +1,34 @@ +#include +#include +void main() +{ + clrscr(); + int arr[10], i, num, n, c=0, pos; + cout<<"Enter the array size : "; + cin>>n; + cout<<"Enter Array Elements : "; + for(i=0; i>arr[i]; + } + cout<<"Enter the number to be search : "; + cin>>num; + for(i=0; i