Commit 6c5185f7 authored by LiniEisha's avatar LiniEisha

12-07-2020

parent 766293e4
from string import punctuation
import re
last_buffer = []
read_lines = [line.rstrip('\n') for line in open('Lecture.txt')]
my_save_data = open("output01.txt", "a")
for lines in read_lines:
re_make_lines = lines.split("[:;?{}]")
for items in re_make_lines:
if items.replace(" ", "") == "":
pass
else:
result = items.strip() + ".\r\n"
my_save_data.write(result)
my_save_data.close()
f1=open("LectureRecording.txt","r")
f2=open("output01.txt","r")
for line1 in f1:
for line2 in f2:
if line1==line2:
print("SAME\n")
else:
print(line1 + line2)
break
f1.close()
f2.close()
f1=open("java02.txt","r")
f2=open("java.txt","r")
for line1 in f1:
for line2 in f2:
if line1==line2:
print("your 1st assignment will be in next week based on core OOP Concepts.")
print("You will get a full question on inheritance and abstraction.")
else:
print(" ")
break
f1.close()
f2.close()
Java is a general-purpose programming language that is class-based, object-oriented, and designed to have as few implementation dependencies as possible. your 1st assignment will be in next week based on core OOP Concepts.
It is intended to let application developers write once, run anywhere (WORA),meaning that compiled Java code can run on all platforms that support Java without the need for recompilation.J You will get a full question on inheritance and abstraction
ava applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of the underlying computer architecture. T
he syntax of Java is similar to C and C++, but it has fewer low-level facilities than either of them.
public class Baby {
String name;
double weight = 5.0;
boolean isMale;
int numPoops = 0;
Baby[] siblings;
}
Java is a general-purpose programming language that is class-based, object-oriented, and designed to have as few implementation dependencies as possible. It is intended to let application developers write once, run anywhere (WORA),meaning that compiled Java code can run on all platforms that support Java without the need for recompilation.Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of the underlying computer architecture. The syntax of Java is similar to C and C++, but it has fewer low-level facilities than either of them. your 1st assignment will be in next week based on core OOP Concepts.
\ No newline at end of file You will get a full question on inheritance and abstraction
from string import punctuation
import re
last_buffer = [] f1=open("java02.txt","r")
read_lines = [line.rstrip('\n') for line in open('Lecture.txt')] f2=open("java.txt","r")
my_save_data = open("output01.txt", "a")
for lines in read_lines:
re_make_lines = lines.split("[:;?{}]")
for items in re_make_lines:
if items.replace(" ", "") == "":
pass
else:
result = items.strip() + ".\r\n"
my_save_data.write(result)
my_save_data.close()
f1=open("LectureRecording.txt","r")
f2=open("output01.txt","r")
for line1 in f1: for line1 in f1:
for line2 in f2: for line2 in f2:
if line1==line2: if line1==line2:
print("SAME\n") print("your 1st assignment will be in next week based on core OOP Concepts.")
print("You will get a full question on inheritance and abstraction.")
else: else:
print(line1 + line2) print(" ")
break break
f1.close() f1.close()
f2.close() f2.close()
import nltk
read_lines = [line.rstrip('\n') for line in open("LectureRecording.txt", "r")]
sentences_list = []
sentence_list = nltk.sent_tokenize(read_lines)
word_search = "important"
sentences_with_word = []
for sentence in sentences_list:
if sentence.count(word_search)>0:
sentences_with_word.append(sentence)
words_search = ["exam", "assignment"]
word_sentence_dictionary = {"exam":[],"assignment":[]}
for word in words_search:
sentences_with_word = []
for sentence in sentences_list:
if sentence.count(word)>0:
sentences_with_word.append(sentence)
word_sentence_dictionary[word] = sentences_with_word
\ No newline at end of file
ast_buffer = []
read_lines = [line.rstrip('\n') for line in open('LectureRecording.txt')]
my_save_data = open("output01.txt", "a")
for lines in read_lines:
re_make_lines = lines.split("[:;?{}]")
for items in re_make_lines:
if items.replace(" ", "") == "":
pass
else:
result = items.strip() + ".\r\n"
my_save_data.write(result)
my_save_data.close()
\ No newline at end of file
import nltk
from nltk.corpus import stopwords
from nltk.cluster.util import cosine_distance
import numpy as np
import networkx as nx
import re
#def read_article(file_name): paragraph = "The beauty lies in the eyes of the beholder. A person can see either a rose or a thorn."
# file = open(file_name, "r") word_search = "beauty"
# filedata = file.readlines() sentences_list = []
# article = filedata[0].split(". ") sentences_list = paragraph.split(".")
# sentences = [] sentences_with_word = []
for sentence in sentences_list:
if sentence.count(word_search)>0:
sentences_with_word.append(sentence)
# for sentence in article: words_search = ["beauty", "rose"]
# print(sentence) word_sentence_dictionary = {"beauty":[],"rose":[]}
# sentences.append(sentence.replace("[^a-zA-Z]", " ").split(" "))
# sentences.pop()
# return sentences for word in words_search:
sentences_with_word = []
sentences = "Today our lecture is based an introduction to Object Oriented Programming Concepts. OBJECT ORIENTED PROGRAMMING is a programming concept that works on the principles. The main principles are abstraction, encapsulation, inheritance, and polymorphism. OOP allows users to create the objects that they want and then, create methods to handle those objects. The basic concept of OOPs is to create objects, re-use them throughout the program, and manipulate these objects to get results. Object Oriented Programming popularly known as OOP, is used in a modern programming language like Java. Students, your 1st assignment will be in next week based on core OOP Concepts. Now Let’s what are Core OOPS concepts. First one is class. The class is a group of similar entities. It is only an logical component which means it is not a physical entity. Now let’s go for example, if you had a class called “Expensive Cars” the object could be like Mercedes, BMW, Toyota, etc. and the properties an be price or speed of these cars. While the methods may be performed with these cars are driving, reverse, braking. Next core concept is object. An object can be defined as an instance of a class, and there can be multiple instances of a class in a program. An Object contains both the data and the function, which operates on the data. For example - chair, bike, marker, pen, table. Next, we have Inheritance. What is inheritance. Inheritance is an OOPS concept in which one object acquires the properties and behaviours of the parent object. It’s creating a parent-child relationship between two classes. It offers robust and natural mechanism for organizing and structure of any software. You will get a full question on inheritance and abstraction. An abstraction is an act of representing essential features without including background details. It is a technique of creating a new data type that is suited for a specific application. Now let’s see an example while driving a car, you do not have to be concerned with its internal working. Here you just need to concern about parts like steering wheel, Gears, accelerator. Ok so do you know what is Encapsulation? It is an OOP method wrapping the data and code. In this OOPS idea, the factors of a class are constantly hidden different classes. It must be gotten to utilizing the techniques for their present class. For instance - in school, an understudy can't exist without a class. Rest of the oop core concepts will be discussed in our next lecture. Before we end the lecture I will tell you some advantages of oop . OOP offers easy to understand and a clear modular structure for programs. Objects created for Object-Oriented Programs can be reused in other programs. Thus it saves significant development cost. Large programs are difficult to write, but if the development and designing team follow OOPS concept then they can better design with minimum flaws. It also enhances program modularity because every object exists independently." for sentence in sentences_list:
if sentence.count(word)>0:
sentences01 = "." + sentences sentences_with_word.append(sentence)
re.findall(r"([^.]*?LectureRecording.txt[^.]*\.)",sentences01) word_sentence_dictionary[word] = sentences_with_word
\ No newline at end of file
What is OOPS?.OBJECT ORIENTED PROGRAMMING (OOP) is a programming concept that works on the principles of abstraction, encapsulation, inheritance, and polymorphism. It allows users to create the objects that they want and then, create methods to handle those objects. The basic concept of OOPs is to create objects, re-use them throughout the program, and manipulate these objects to get results.Object Oriented Programming popularly known as OOP, is used in a modern programming language like JavaCore OOPS concepts are1) ClassThe class is a group of similar entities. It is only an logical component and not the physical entity. For example, if you had a class called “Expensive Cars” it could have objects like Mercedes, BMW, Toyota, etc. Its properties(data) can be price or speed of these cars. While the methods may be performed with these cars are driving, reverse, braking etc.2) ObjectAn object can be defined as an instance of a class, and there can be multiple instances of a class in a program. An Object contains both the data and the function, which operates on the data. For example - chair, bike, marker, pen, table, car, etc.3) InheritanceInheritance is an OOPS concept in which one object acquires the properties and behaviours of the parent object. It’s creating a parent-child relationship between two classes. It offers robust and natural mechanism for organizing and structure of any software.4) PolymorphismPolymorphism refers to the ability of a variable, object or function to take on multiple forms. For example, in English, the verb run has a different meaning if you use it with a laptop, a foot race, and business. Here, we understand the meaning of run based on the other words used along with it. The same also applied to Polymorphism.5) AbstractionAn abstraction is an act of representing essential features without including background details. It is a technique of creating a new data type that is suited for a specific application. For example, while driving a car, you do not have to be concerned with its internal working. Here you just need to concern about parts like steering wheel, Gears, accelerator, etc.6) EncapsulationEncapsulation is an OOP technique of wrapping the data and code. In this OOPS concept, the variables of a class are always hidden from other classes. It can only be accessed using the methods of their current class. For example - in school, a student cannot exist without a class.7) AssociationAssociation is a relationship between two objects. It defines the diversity between objects. In this OOP concept, all object have their separate lifecycle, and there is no owner. For example, many students can associate with one teacher while one student can also associate with multiple teachers.8) AggregationIn this technique, all objects have their separate lifecycle. However, there is ownership such that child object can’t belong to another parent object. For example consider class/objects department and teacher. Here, a single teacher can’t belong to multiple departments, but even if we delete the department, the teacher object will never be destroyed.9) CompositionA composition is a specialized form of Aggregation. It is also called "death" relationship. Child objects do not have their lifecycle so when parent object deletes all child object will also delete automatically. For that, let’s take an example of House and rooms. Any house can have several rooms. One room can’t become part of two different houses. So, if you delete the house room will also be deleted.Advantages of OOPS:OOP offers easy to understand and a clear modular structure for programs.Objects created for Object-Oriented Programs can be reused in other programs. Thus it saves significant development cost.Large programs are difficult to write, but if the development and designing team follow OOPS concept then they can better design with minimum flaws.It also enhances program modularity because every object exists independently. Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data, in the form of fields (often known as attributes or properties), and code, in the form of procedures (often known as methods). A feature of objects is an object's procedures that can access and often modify the data fields of the object with which they are associated (objects have a notion of "this" or "self"). In OOP, computer programs are designed by making them out of objects that interact with one another.[1][2] OOP languages are diverse, but the most popular ones are class-based, meaning that objects are instances of classes, which also determine their types.Object oriented ptogramming(OOP) is a programming concept that works on the principles of abstraction, encapsulation, inheritance, and polymorphism. It allows users to create the objects that they want and then, create methods to handle those objects. The basic concept of OOPs is to create objects, re-use them throughout the program, and manipulate these objects to get results.Object Oriented Programming popularly known as OOP, is used in a modern programming language like JavaCore OOPS concepts are1) ClassThe class is a group of similar entities. It is only an logical component and not the physical entity. For example, if you had a class called “Expensive Cars” it could have objects like Mercedes, BMW, Toyota, etc. Its properties(data) can be price or speed of these cars. While the methods may be performed with these cars are driving, reverse, braking etc.2) ObjectAn object can be defined as an instance of a class, and there can be multiple instances of a class in a program. An Object contains both the data and the function, which operates on the data. For example - chair, bike, marker, pen, table, car, etc.3) InheritanceInheritance is an OOPS concept in which one object acquires the properties and behaviours of the parent object. It’s creating a parent-child relationship between two classes. It offers robust and natural mechanism for organizing and structure of any software.4) PolymorphismPolymorphism refers to the ability of a variable, object or function to take on multiple forms. For example, in English, the verb run has a different meaning if you use it with a laptop, a foot race, and business. Here, we understand the meaning of run based on the other words used along with it. The same also applied to Polymorphism.5) AbstractionAn abstraction is an act of representing essential features without including background details. It is a technique of creating a new data type that is suited for a specific application. For example, while driving a car, you do not have to be concerned with its internal working. Here you just need to concern about parts like steering wheel, Gears, accelerator, etc.6) EncapsulationEncapsulation is an OOP technique of wrapping the data and code. In this OOPS concept, the variables of a class are always hidden from other classes. It can only be accessed using the methods of their current class. For example - in school, a student cannot exist without a class.7) AssociationAssociation is a relationship between two objects. It defines the diversity between objects. In this OOP concept, all object have their separate lifecycle, and there is no owner. For example, many students can associate with one teacher while one student can also associate with multiple teachers.8) AggregationIn this technique, all objects have their separate lifecycle. However, there is ownership such that child object can’t belong to another parent object. For example consider class/objects department and teacher. Here, a single teacher can’t belong to multiple departments, but even if we delete the department, the teacher object will never be destroyed.9) CompositionA composition is a specialized form of Aggregation. It is also called "death" relationship. Child objects do not have their lifecycle so when parent object deletes all child object will also delete automatically. For that, let’s take an example of House and rooms. Any house can have several rooms. One room can’t become part of two different houses. So, if you delete the house room will also be deleted.Advantages of OOPS:OOP offers easy to understand and a clear modular structure for programs.Objects created for Object-Oriented Programs can be reused in other programs. Thus it saves significant development cost.Large programs are difficult to write, but if the development and designing team follow OOPS concept then they can better design with minimum flaws.It also enhances program modularity because every object exists independently.
Today our lecture is based an introduction to Object Oriented Programming Concepts. OBJECT ORIENTED PROGRAMMING is a programming concept that works on the principles. The main principles are abstraction, encapsulation, inheritance, and polymorphism. OOP allows users to create the objects that they want and then, create methods to handle those objects. The basic concept of OOPs is to create objects, re-use them throughout the program, and manipulate these objects to get results. Object Oriented Programming popularly known as OOP, is used in a modern programming language like Java. Students, your 1st assignment will be in next week based on core OOP Concepts. Now Let’s what are Core OOPS concepts. First one is class. The class is a group of similar entities. It is only an logical component which means it is not a physical entity. Now let’s go for example, if you had a class called “Expensive Cars” the object could be like Mercedes, BMW, Toyota, etc. and the properties an be price or speed of these cars. While the methods may be performed with these cars are driving, reverse, braking. Next core concept is object. An object can be defined as an instance of a class, and there can be multiple instances of a class in a program. An Object contains both the data and the function, which operates on the data. For example - chair, bike, marker, pen, table. Next, we have Inheritance. What is inheritance. Inheritance is an OOPS concept in which one object acquires the properties and behaviours of the parent object. It’s creating a parent-child relationship between two classes. It offers robust and natural mechanism for organizing and structure of any software. You will get a full question on inheritance and abstraction. An abstraction is an act of representing essential features without including background details. It is a technique of creating a new data type that is suited for a specific application. Now let’s see an example while driving a car, you do not have to be concerned with its internal working. Here you just need to concern about parts like steering wheel, Gears, accelerator. Ok so do you know what is Encapsulation? It is an OOP method wrapping the data and code. In this OOPS idea, the factors of a class are constantly hidden different classes. It must be gotten to utilizing the techniques for their present class. For instance - in school, an understudy can't exist without a class. Rest of the oop core concepts will be discussed in our next lecture. Before we end the lecture I will tell you some advantages of oop . OOP offers easy to understand and a clear modular structure for programs. Objects created for Object-Oriented Programs can be reused in other programs. Thus it saves significant development cost. Large programs are difficult to write, but if the development and designing team follow OOPS concept then they can better design with minimum flaws. It also enhances program modularity because every object exists independently. Today our lecture is based an introduction to Object Oriented Programming Concepts. OBJECT ORIENTED PROGRAMMING is a programming concept that works on the principles. The main principles are abstraction, encapsulation, inheritance, and polymorphism. OOP allows users to create the objects that they want and then, create methods to handle those objects. The basic concept of OOPs is to create objects, re-use them throughout the program, and manipulate these objects to get results. Object Oriented Programming popularly known as OOP, is used in a modern programming language like Java. Students, your 1st exam will be in next week based on core OOP Concepts. Now Let’s what are Core OOPS concepts. First one is class. The class is a group of similar entities. It is only an logical component which means it is not a physical entity. Now let’s go for example, if you had a class called “Expensive Cars” the object could be like Mercedes, BMW, Toyota, etc. and the properties an be price or speed of these cars. While the methods may be performed with these cars are driving, reverse, braking. Next core concept is object. An object can be defined as an instance of a class, and there can be multiple instances of a class in a program. An Object contains both the data and the function, which operates on the data. For example - chair, bike, marker, pen, table. Next, we have Inheritance. What is inheritance. Inheritance is an OOPS concept in which one object acquires the properties and behaviours of the parent object. It’s creating a parent-child relationship between two classes. It offers robust and natural mechanism for organizing and structure of any software. You will get a full question on inheritance and abstraction for your exam. An abstraction is an act of representing essential features without including background details. It is a technique of creating a new data type that is suited for a specific application. Now let’s see an example while driving a car, you do not have to be concerned with its internal working. Here you just need to concern about parts like steering wheel, Gears, accelerator. Ok so do you know what is Encapsulation? It is an OOP method wrapping the data and code. In this OOPS idea, the factors of a class are constantly hidden different classes. It must be gotten to utilizing the techniques for their present class. For instance - in school, an understudy can't exist without a class. Rest of the oop core concepts will be discussed in our next lecture. Before we end the lecture I will tell you some advantages of oop . OOP offers easy to understand and a clear modular structure for programs. Objects created for Object-Oriented Programs can be reused in other programs. Thus it saves significant development cost. Large programs are difficult to write, but if the development and designing team follow OOPS concept then they can better design with minimum flaws. It also enhances program modularity because every object exists independently.
\ No newline at end of file \ No newline at end of file
import bs4 as bs
import urllib.request
import re
import nltk
scraped_data = urllib.request.urlopen('https://www.guru99.com/java-oops-concept.html')
lecture = scraped_data.read()
parsed_lecture = bs.BeautifulSoup(lecture,'lxml')
paragraphs = parsed_lecture.find_all('p')
lecture_text = ""
for p in paragraphs:
lecture_text += p.text
lecture_text = re.sub(r'\[[0-9]*\]', ' ', lecture_text)
lecture_text = re.sub(r'\s+', ' ', lecture_text)
formatted_lecture_text = re.sub('[^a-zA-Z]', ' ', lecture_text )
formatted_lecture_text = re.sub(r'\s+', ' ', formatted_lecture_text)
sentence_list = nltk.sent_tokenize(lecture_text)
stopwords = nltk.corpus.stopwords.words('english')
word_frequencies = {}
for word in nltk.word_tokenize(formatted_lecture_text):
if word not in stopwords:
if word not in word_frequencies.keys():
word_frequencies[word] = 1
else:
word_frequencies[word] += 1
maximum_frequncy = max(word_frequencies.values())
for word in word_frequencies.keys():
word_frequencies[word] = (word_frequencies[word]/maximum_frequncy)
sentence_scores = {}
for sent in sentence_list:
for word in nltk.word_tokenize(sent.lower()):
if word in word_frequencies.keys():
if len(sent.split(' ')) < 30:
if sent not in sentence_scores.keys():
sentence_scores[sent] = word_frequencies[word]
else:
sentence_scores[sent] += word_frequencies[word]
import heapq
summary_sentences = heapq.nlargest(20, sentence_scores, key=sentence_scores.get)
summary = ' '.join(summary_sentences)
print(summary)
\ No newline at end of file
Java is a general-purpose programming language that is class-based, object-oriented, and designed to have as few implementation dependencies as possible. your 1st assignment will be in next week based on core OOP Concepts.
It is intended to let application developers write once, run anywhere (WORA),meaning that compiled Java code can run on all platforms that support Java without the need for recompilation.J You will get a full question on inheritance and abstraction
ava applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of the underlying computer architecture. T
he syntax of Java is similar to C and C++, but it has fewer low-level facilities than either of them.
public class Baby {
String name;
double weight = 5.0;
boolean isMale;
int numPoops = 0;
Baby[] siblings;
}
Java is a general-purpose programming language that is class-based, object-oriented, and designed to have as few implementation dependencies as possible. It is intended to let application developers write once, run anywhere (WORA),meaning that compiled Java code can run on all platforms that support Java without the need for recompilation.Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of the underlying computer architecture. The syntax of Java is similar to C and C++, but it has fewer low-level facilities than either of them. your 1st assignment will be in next week based on core OOP Concepts.
\ No newline at end of file You will get a full question on inheritance and abstraction
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment