parsing tree programing assignment

Similar to the parsing tree example in class, there is not much usefulness in parsing and evaluating statements without an operator. Therefore, it is safe to assume that any input to your parsing tree will contain an operator.

Examples of valid inputs are: 

  • ( T AND F )
  • ( ( T OR M_0.3 ) AND P_0.8 )
  • ( P_0.9 OR M_0.4 )

Example of inputs that are not expected (and that you don’t need to account for):

  • ( T )
  • ( P_0.85 )
  • ( F )

Also, if you haven’t started, and want a clean slate to start with, use this skeleton code in MS Teams: mp_parse.py (Links to an external site.)

What is the assignment?

  • To implement functions to build, evaluate, and print expressions using our (made-up) maybe-probably logic

What to hand in? 

  • One (and only one) *.py file should be handed in. All your checks, unit tests should be inside of this file (similar to last assignment).
  • Note that your program should be able to be run at console/terminal (e.g. $ python your_file.py). If it does not, then the execution portion of the assignment will be 0. 
  • Also note that you do not need to hand in binarytree.py nor stack.py; and you do *not* need to copy them into your file. Just import them. (For Peer Reviewers, ensure you put the code you will review in the same directory as 

What needs to be done? 

The primary tasks in this fourth assignment are to implement the following three functions.

1. buildMPLogicParseTree(s) – this function should take a string as input (e.g. s = ‘( T OR P_0.9 )’) and should return the binary tree representing the parse tree as described in class

2. evaluateMPLogicParseTree(t) – this function should take a binary tree as input and should return a T or an F that is based on the on the input statement

3. printMPLogicExpression(t) – this function should take a binary tree as input and should return the string that looks like the original string (perhaps with extra parentheses)

4. create some examples of how your functions work (inside of def main()), and test that each of the functions works correctly (using unittest)

Note: Those exact function names above should be used. If those name are not used 10pts will be automatically deducted.

Also:

  • you should use the file parsetree.py for inspiration (located in MS Teams -> General -> Files -> Code); note: that file is for building entirely different types of parse trees so only parts of it will be relevant to this assignment
  • you will also want to download the files binarytree.py and stack.py, and import them from your *.py file (all three files will need to exist in the same directory/folder)
  • as with the last assignment, your *.py file will be run through a test script 

When you submit your assignment, it will be graded in large part based on whether it successfully runs when using different input strings. The tests will roughy look like the following:

pt = buildMPLogicParseTree('( ( T AND F ) OR M_0.3 )')
ans = evaluateMPLogicParseTree(pt)
exp = printMPLogicExpression(pt)
# pt, ans, and exp will all be checked to ensure they are correct

Again, several different input strings will be also be tested.

When an M_x or P_x is present then the test will confirm that your tree evaluates to the correct average.

For example, the above input string will evaluate to T roughly 30% of the time. 

What does maybe-probably logic look like again, exactly? 

The symbols of our maybe-probably Boolean logic are:

  • T – denotes True
  • F – denotes False
  • M_x is a maybe symboled that evaluates to true with probability x, 0.0 <= x <= 0.75 Ø
  • P_x is a probably symbol that evaluates to true w/ probability x, 0.75 <= x < 1.0 Ø
  • AND, OR – the two operators (note, these are binary operators)
  • (, ) – parentheses are to be used in the same way as with the parse tree.py example we saw in class

Some additional examples of statements in this language are:

  • ( T AND F ) a should evaluate to F for False
  • ( T OR F ) a should evaluate to T for False
  • ( M_0.7 ) a should evaluate to T for True 70% of the time
  • ( M_0.9 ) invalid since parameter x is greater than 0.75!!
  • ( ( P_0.8 AND T ) OR ( M_0.25 ) ) a should evaluate to true 85% of the time

As with other assignments, the final code should be your own work. However, discussing the general approach, or specific Python issues/functions, with others (e.g. on MSU Discord server), is acceptable, and encouraged! Of course, don’t hesitate to ask questions in MS Teams, by email, and in class. Again, note that the tree should include x, and that M_x or P_x terms should evaluate only inside of the evaluate function.

discussion 11/07

Discuss how your employer prepares to establish, maintain, and execute your temporary work area to reestablish or maintain your business operations.  You can use information from your employer, outside research, or your personal work experiences as your basis for this discussion. 

400 words.

Term Paper

Finish the term paper using the following outline. In addition to the 4-6 pages of the paper itself, you must include a title page and a reference page. You are to follow APA Guidelines for citing and referencing sources. Your paper must be in your own words, representing original work. Paraphrases of others’ work must include attributions to the authors. Limit quotations to an average of no more than 3-5 lines, and use quotations sparingly. It is always better to write the information in your own words than to directly quote. 

Title: Penalties and adjudication for various information and technology offenses.

Thesis: Penalties and adjudication for various information and technology offenses are not playing the crucial role of securing the abolition of breaching the law, which has been set, to safely guide the key players in the platform. The law is not even ensuring that those people who temple with the originality of a given person work.

i. Introduction 

a. Thesis 

b. The role of the thesis. 

ii. Expounding on the law and some of the changes needs to make it better.

a. Background of the law

b. Some of the recommendation that has been pointed out concerning the law by different stakeholders.

c. The effects of the law on today’s information and technology industry.

iii. The main objectives of the law.

a. The success and the future of IT in the country

b. The goals of addressing the topic 

c. The significance of the law and the setbacks  

d. The significance of implement the law to the grass root.

iv. The benefit of law to the industry 

a. The key traits of  for success  

b. The goal of the law 

c. Efforts to introduce new laws and ensuring they have been followed.

i. Significance of changing some articles  in the law

ii. Incorporating of organs to ensure that the effectiveness of the law

d. Making sure that the law meets the national and international standards 

v. Recommendation from the writer’s view.

a. Some of the things that can make a difference in the information and technology sector.

vi. Conclusion 

a. Summarizing the arguments and efforts made 

Reference

Bottoms, A. (2001). Compliance and community penalties. Community penalties: Change and challenges, 87-116.

Roth, M. P. (2010). Crime and punishment: A history of the criminal justice system. Nelson Education.

Discusssin

 List three (3) advantages and three (3) disadvantages cloud-based providers have with respect to security using them as LEVEL 1 HEADINGS. Then, in YOUR  OWN words, and from an IT security manager’s perspective, explain how each advantage can help your business succeed and how each disadvantage can hurt business operations. 

Assignment

Write a 3-page paper (1000 words): What are the intelligent agents of AI? Write the agents and environments of artificial intelligence What are the nature of the environments and structure of the agents.?
Provide examples and present your written findings. You must write a 3-page essay in APA format. You must include 3 scholarly reviewed references that are DIRECTLY related to the subject.