Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uploaded files for script to fetch top imbd files #43

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
7,425 changes: 7,425 additions & 0 deletions scripts/Crop Prediction Model/Crop Prediction Model.ipynb

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions scripts/Crop Prediction Model/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Crop Prediction Model

A machine learning model to predict the best suitable crop to grow on a particular piece of land based on different factors like humidity, ph, rainfall.

## Data set used

The data set is taken from kaggle which includes data of several crops.
link - https://www.kaggle.com/datasets/atharvaingle/crop-recommendation-dataset

## Pycaret
I have used pycaret to compare all the classification models and optimized them for the best results.
5 changes: 5 additions & 0 deletions scripts/Fetching trending stocks using nlp/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## How to run the app
To run the app, simply open the cmd in the directory and run
command - streamlit run app.py

Note: It can take 5-10 mins to load and show the trending stocks.
77 changes: 77 additions & 0 deletions scripts/Fetching trending stocks using nlp/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import pandas as pd
import requests
import spacy
import streamlit as st
import os

from spacy import displacy
from bs4 import BeautifulSoup
import yfinance as yf
import matplotlib

st.title('Trending Stocks :zap:')

def extract_text_from_rss(rss_link):
headings = []
r1 = requests.get('https://economictimes.indiatimes.com/markets/stocks/rssfeeds/2146842.cms')
r2 = requests.get(rss_link)
soup1 = BeautifulSoup(r1.content, features='lxml')
soup2 = BeautifulSoup(r2.content, features='lxml')
headings1 = soup1.findAll('title')
headings2 = (soup2.findAll('title'))
print(headings2)
headings = headings1 + headings2
return headings


token_dict = {
'Org': [],
'Symbol': [],
'currentPrice': [],
'dayHigh': [],
'dayLow': [],
'forwardPE': [],
'dividendYield': []
}
nlp = spacy.load("en_core_web_sm")

def stock_info(headings):

stocks_df = pd.read_csv("./data/ind_nifty500list.csv")
for title in headings:
doc = nlp(title.text)
for token in doc.ents:
try:
if stocks_df['Company Name'].str.contains(token.text).sum():
symbol = stocks_df[stocks_df['Company Name'].\
str.contains(token.text)]['Symbol'].values[0]
org_name = stocks_df[stocks_df['Company Name'].\
str.contains(token.text)]['Company Name'].values[0]
token_dict['Org'].append(org_name)
print(symbol+".NS")
token_dict['Symbol'].append(symbol)
stock_info = yf.Ticker(symbol+".NS").info
token_dict['currentPrice'].append(stock_info['currentPrice'])
token_dict['dayHigh'].append(stock_info['dayHigh'])
token_dict['dayLow'].append(stock_info['dayLow'])
token_dict['forwardPE'].append(stock_info['forwardPE'])
token_dict['dividendYield'].append(stock_info['dividendYield'])
else:
pass
except:
pass
output_df = pd.DataFrame(token_dict)
return output_df


user_input = st.text_input("Add your RSS link here!", "https://www.moneycontrol.com/rss/buzzingstocks.xml")

fin_headings = extract_text_from_rss(user_input)

output_df = stock_info(fin_headings)
output_df.drop_duplicates(inplace=True)
st.dataframe(output_df)

with st.expander("Expand for Financial News!"):
for h in fin_headings:
st.markdown("* " + h.text)
53 changes: 53 additions & 0 deletions scripts/Fetching trending stocks using nlp/data/History_102.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
0 Betancourt, Rómulo
The chief long-term effect was the prolonged divi- U.S. intromission in this oil-rich country, Betancourt
sion of Germany. The Western Allies had confronted the contributed in enduring ways to the institutionaliza-
Soviets and had maintained their commitments without tion of Venezuelan democracy.
having to resort to armed action. The blockade also Born in the town of Guatire in the state of Miranda
proved damaging to world opinion of the Soviet Union. to a family of modest means, he starting working at
Berlin, long perceived as a bastion of German-Prussian 14 years of age to put himself through high school,
militarism, had been transformed into a symbol of free- college, and law school. In 1928 he participated in stu-
dom. The allied presence in Berlin would be the source dent protests against the dictatorship of Juan Vicente
of almost constant difficulty for the East German state, Gómez, events marking him as a leading member of
as it provided an enclave of Western liberalism and eco- the “Generation of 28” dedicated to democratization
nomic prosperity that was a constant source of entice- and social reform. After being jailed by the Gómez
ment for the citizens of the communist state. West Berlin regime he went into exile and became active in various
would be a popular destination for East German emi- leftist political groups, including the Communist Party
grants over the course of the next decade, their massive of Costa Rica.
flight from the east stopped only by the erection of the At age 23 he penned the Plan of Barranquilla, a
Berlin Wall in 1961. Marxist-inspired document outlining his vision of
See also cold war. his homeland’s political future. After Gómez’s death
in 1936, he returned clandestinely to Venezuela and
Further reading: Eisenberg, Carolyn. Drawing the Line: became engaged in political activity against the mili-
The American Decision to Divide Germany, 1944–1949. tary regime. In 1940 he went into exile in Chile, where
New York: Cambridge University Press, 1996; Gaddis, he published Venezuelan Problems (Problemas Vene-
John Lewis. The Cold War: A New History. New York: zolanos). A year later he returned to Venezuela and
Penguin Press, 2005; Haydock, Michael. City Under Siege: founded AD, gathering around him a team commit-
The Berlin Blockade and Airlift, 1948–1949. Washington, ted to reform that formed the nucleus of the party and
D.C.: Brassey’s, 1999; Large, David Clay. Berlin. Berlin: skillfully using the press and other media to dissemi-
Basic Books, 2000; Parrish, Thomas. Berlin in the Bal- nate his ideas.
ance, 1945–1949: The Blockade, Airlift, the First Major On October 19, 1945, a coalition of AD reformers
Battle of the Cold War. Reading, MA: Addison-Wesley, 1999; and disgruntled army officers overthrew the military
Trachtenberg, Marc. A Constructed Peace: The Making of regime and installed Betancourt as president of a provi-
the European Settlement, 1945–1963. Princeton, NJ: Princ- sional government. During his first presidency (1945–
eton University Press, 1999. 48), Betancourt’s government instituted a wide range
of political, economic, and social reforms, including
Nicholas J. Schlosser universal suffrage; mechanisms for free and fair elec-
tions; an accord with foreign oil companies that guar-
anteed a reasonable profit, decent wages, and ensured
Betancourt, Rómulo
labor peace; agrarian reform; expansion of public edu-
(1908–1981) Venezuelan president cation and public health facilities; and related initia-
tives. Declining to run for a second successive term, in
One of the leading figures of 20th-century Venezuelan 1948 he transferred power to his successor, the novel-
history, Rómulo Betancourt is generally credited with ist and activist Rómulo Gallegos. Later that year, in
playing a pivotal role in helping to establish viable and December, the military in collusion with conservative
sustainable democratic institutions in Venezuela that elements overthrew the Gallegos government, ruling
endured from his second presidency (1959–64) to the Venezuela for the next 10 years under General Marcos
2000s. A moderate social reformer and forerunner of Pérez Jiménez.
latter-day Venezuelan president Hugo Chávez in his In 1958 a resurgent coalition of reformers and
advocacy of populist social democracy focusing on the army officers overthrew the Jiménez regime, installing
needs of the poor, Betancourt founded the political party a democratic AD-dominated government, with Betan-
Democratic Action (Acción Democrática, AD) in 1941, court again as president, which broadened and deep-
which would play a major role in subsequent Venezu- ened the reforms of the 1940s. Since 1958 Venezuela
elan political life. Threading a difficult line between the has been ruled by a succession of democratically elect-
far Left, the far Right, and the omnipresent specter of ed governments. Surviving an assassination attempt
Loading