Как разобрать таблицы с простым текстом?(несколько строк) - PullRequest
0 голосов
/ 28 февраля 2019

Я хочу разобрать таблицу, которая легко читается визуально, но в которой отсутствуют реальные шаблоны.Мне бы хотелось, чтобы он был в виде словаря на Python, но в конечном итоге я превращу его в фрейм данных.На самом деле слева направо 6 столбцов: единицы курса 1, код курса 1, название курса 1, код курса 2, название курса 2, курс курса 2 единицы.Это может быть еще сложнее разобрать, хотя.Любая помощь приветствуется.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<!-- $Id: bymaj_report.htm,v 1.9 2008/01/29 17:54:48 adt Exp $ -->





 ASSIST: By Major Report 




                        Articulation Agreement by Major                         
                    Effective during the 16-17 Academic Year                    
     
    ====Electrical Engineering & Computer Sciences, Lower Division B.S.====     
                                                                             
COLLEGE OF ENGINEERING JUNIOR TRANSFER ADMISSION REQUIREMENTS:              
                                                                                
Admission to the UC Berkeley College of Engineering is highly competitive.
                                                                                
Applicants to the Electrical Engineering and Computer Science major must
complete all required core UCB preparation courses in order to be eligible for
admission. Only applicants who have completed 100% of these required courses
will be considered for admission.  Required courses for admission to the major
must be completed by the end of the spring semester prior to fall enrollment.
A summer 2017 course is not considered to be "work in progress" for the fall
2017 selection process.
                                                                                
If a series of courses at a community college is required (e.g., English 1A + 1B
+ 103 = English R1A and R1B), all the courses in the series must be completed,
and must (unless otherwise indicated) be completed at the same community
college. Partial completion (e.g., 2 of the 3 required courses) will result in
zero credit toward the requirement(s), and the applicant will NOT be considered
for admission.
                                                                             
Lower division UC Berkeley courses required for graduation (but not admission)
are also listed in the major agreements and are strongly recommended to be taken
to strengthen one's application.  The more of these courses completed, the
stronger the application will be.
                                                                                
Required core courses for admission: (all these courses must be completed to be
considered for admission)
                                                                                
- UCB Math 1A, 1B                                                               
- UCB Math 53, 54                                                               
- UCB Physics 7A, 7B                                                            
- UCB English R1A and R1B                                                       
- One from UCB Astronomy 7A or 7B or Bio 1A & 1AL or Bio 1B or Chem 1A/1AL or   
  Chem 1B or Chem 3A/L or 3B/L or Mcellbi 32 & 32L or Physics 7C                
                                                                                
Strongly recommended courses: (if your college offers the courses listed below
and they are articulated, taking them will strengthen your application)
                                                                                
Electrical Engineering 20 and 40 were taught for the final time at UCB in Fall
2015.  Electrical Engineering 20 and Electrical Engineering 40 have been
replaced with Electrical Engineering 16A and 16B.  The curriculum changes are
effective for students admitted beginning Fall 15. 
                                                                                
- UCB Compsci 61A                                                               
- UCB Compsci 61B                                                               
- UCB Compsci 61C                                                               
- UCB El Eng 16A                                                                
- UCB El Eng 16B                                                                
- UCB Compsci 70                                                                
                                                                                
Admission is primarily based on the completeness of the applicant's lower
division preparation and the level of academic achievement reflected in the
student's grade point average.  The UC applicant essay also plays an important
role in the selection process at UC Berkeley.  The College reviews the essay for
evidence of interest in the student's chosen field and a thoughtful match
between the academic program and the student's academic and career objectives.
                                                                                
The College of Engineering requires six humanities/social science courses, two
of which must be reading and composition.  The only non-technical admission
requirement for the College of Engineering is the coursework equivalent to UC
Berkeley's English R1A and R1B (reading and composition), which must be taken
for a letter grade. The College of Engineering does not recognize the
Intersegmental General Education Transfer Curriculum (IGETC) and strongly
discourages students from following this option due to the number of
major-specific technical courses required for engineering transfer admission.
NOTE: The English R1A and R1B requirements cannot be satisfied by IGETC;
applicants must complete the specific courses indicated as English R1A and R1B
equivalents to be considered for admission. Failure to complete the exact
courses listed will mean the applicant will NOT be considered for admission.
                                                                                
The remaining four humanities/social science requirement courses are not
considered for admission purposes but are required for graduation.  See
http://engineering.berkeley.edu/hssreq for the College of Engineering
humanities/social science breadth requirements and courses.  Courses which are
three semester units or more that appear in the following categories on the
"General Education/Breadth" section of assist.org may be used to satisfy
two of the remaining four humanities/social science course requirements for the
College of Engineering.  ARTS AND LITERATURE; HISTORICAL STUDIES; INTERNATIONAL
STUDIES; PHILOSOPHY AND VALUES; SOCIAL AND BEHAVIORAL SCIENCES.
                                                                                
SAT/ACT/A-level test scores and letters of recommendation are NOT considered for
admission.
                                                                                
NOTE: ALL REQUIRED COURSES AND ALL STRONGLY RECOMMENDED COURSES FOR THE MAJOR
MUST BE TAKEN FOR A LETTER GRADE.  FOR MORE INFORMATION, PLEASE CHECK THE
COLLEGE'S WEB SITE FOR THE COLLEGE OF ENGINEERING UNDERGRADUATE GUIDE.
                                                                                
For more information:                                                           
http://engineering.berkeley.edu/admissions/undergraduate-admissions 
                                                                                
College of Engineering Undergraduate Guide:                                 
http://engineering.berkeley.edu/academics/undergraduate-guide
                                                                            
For more information on Electrical Engineering & Computer Science:          
http://www.eecs.berkeley.edu
                                                                                
For more information on admission to UC Berkeley:                        
http://admissions.berkeley.edu
                                                                                
For more information on majors at UC Berkeley:                           
Berkeley Academic Guide: http://guide.berkeley.edu
                                                                                
--------------------------------------------------------------------------------
 AP TEST CREDIT                         
                                                                                
For students who have taken Advanced Placement Exams in high school, the College
will clear requirements as follows:
                                                                                
Biology AP: a score of 4 or 5 satisfies UCB Biology 1A/AL and 1B.               
Chemistry AP: a score of 3 or better satisfies UCB Chemistry 1A/1AL.            
English AP (Literature and Composition): a score of 4 or 5 satisfies UCB English
R1A.
English AP (Language and Composition): a score of 4 or 5 satisfies UCB English
R1A.
Mathematics AP (AB Exam): a score of 3 or better satisfies UCB Math 1A.         
Mathematics AP (BC Exam): a score of 3 satisfies UCB Math 1A.                   
Mathematics AP (BC Exam): a score of 4 or 5 satisfies UCB Math 1A and 1B.       
Physics AP (Mechanics C Exam): a score of 5 satisfies UCB Physics 7A.           
--------------------------------------------------------------------------------
                          Required Courses for Admission:                
--------------------------------------------------------------------------------
MATH 1A    Calculus                   (4)|MATH 150    Calculus and Analytic  (5)
                                         |            Geometry I 
--------------------------------------------------------------------------------
MATH 1B    Calculus                   (4)|MATH 155    Calculus and Analytic  (4)
                                         |            Geometry II 
--------------------------------------------------------------------------------
MATH 53    Multivariable Calculus     (4)|MATH 260    Calculus and Analytic  (4)
                                         |            Geometry III 
--------------------------------------------------------------------------------
MATH 54    Linear Algebra and         (4)|MATH 265 &
Дифференциальные уравнения (4) Дифференциальные уравнения | MATH 270 Линейная алгебра (4) -------------------------------------------------------------------------------- ФИЗИКА 7A Физика для ученых (4) | PHYS 151 Основы физики (4) и инженеры |Я -------------------------------------------------------------------------------- ФИЗИКА 7B Физика для ученых (4) | PHYS 152 Основы физики (4) и инженеров|II -------------------------------------------------------------------------------- РУССКИЙ R1A Чтение и (4) | ENGL 100 Состав и (4) Состав |Чтение -------------------------------------------------------------------------------- ENGLISH R1B Чтение и (4) | ENGL 201 Критическое мышление, (4) Состав |Композиция и |Литература | ИЛИ || ENGL 201H Критическое мышление, (4) |Композиция и |Литература (с отличием) | ИЛИ | ENGL 202 Критическое мышление и (4) |Композиция | ИЛИ | ENGL 202H Критика и мышление (4) |и композиция |(С отличием) -------------------------------------------------------------------------------- Естественные науки, необходимые для поступления: Один курс или серия курсовтребуется из списка ниже: -------------------------------------------------------------------------------- ASTRON 7A Введение в (4) | НЕТ КУРСА СУЩЕСТВУЕТ Астрофизика |-------------------------------------------------------------------------------- ASTRON 7B Введение в (4) | НЕТ КУРСА АРТИКУЛИРОВАННОЙ Астрофизики |-------------------------------------------------------------------------------- БИОЛОГИЯ 1A & Общая биология (3)| BIO 202 & Основы биологии: (4) Лекция (Клетки, | Эволюция, Генетика, Форма животных | Биоразнообразие и функции) |Органическая биология БИОЛОГИЯ 1AL & Общая биология (2) | BIO 204 Основы биологии: (4) Лаборатория |Биохимия, клеточная биология 1B Общая биология (Растение (4) | Биология, генетика иФорма и функции, |Молекулярная биология, экология, эволюция) |-------------------------------------------------------------------------------- ХИМ 1A & Общая химия (3)| CHEM 110 & Общая химия (5) CHEM 1AL & Общая химия (1) | CHEM 111 Общая химия (5) Лаборатория| ИЛИ CHEM 1B Общая химия (4) | CHEM 110H & Общая химия I (5) |(С отличием) | CHEM 111H Общая химия II (5) |(С отличием) -------------------------------------------------------------------------------- CHEM 3A & Химическая структураи (3) | CHEM 210 Органическая химия I (5) Реакционная способность | ИЛИ CHEM 3AL Органическая химия (2) | CHEM 210H Органическая химия I (5) Лаборатория |(С отличием) -------------------------------------------------------------------------------- CHEM 3B & Химическая структураи (3) | CHEM 211 Органическая химия II (5) Реакционная способность | ИЛИ CHEM 3BL Органическая химия (2) | CHEM 211H Органическая химия II (5) Лаборатория |(С отличием) -------------------------------------------------------------------------------- MCELLBI 32 & Введение вЧеловек (3) | BIO 220 Физиология человека (4) Физиология |MCELLBI 32L Введение в человека (2) |Физиологическая лаборатория |-------------------------------------------------------------------------------- PHYSICS 7C Физика для ученых (4) | PHYS 253 Основы физики (4) и инженеры |III -------------------------------------------------------------------------------- Настоятельно рекомендуемые курсы (если ваш колледж предлагает курсы, перечисленные ниже, и онисформулированы, принятие их усилит ваше применение): Электротехника 20 и 40 в последний раз обучалась в UCB осенью 2015 года. Электротехника 20 и Электротехника 40 были заменены на Электротехника 16А и 16В. Изменения в учебной программе эффективны для студентов, поступивших начиная с осени 15 .Если артикуляция отсутствует, студентам настоятельно рекомендуется пройти вводный курс по электронике или схемам И курсы по Java, C ++ и структурам данных.-------------------------------------------------------------------------------- COMPSCI 61A Структура и (4) | НЕТ КУРСА СУЩЕСТВУЕТ Интерпретация |Компьютерные программы |-------------------------------------------------------------------------------- COMPSCI 61B Структуры данных (4) | CS 112 & Введение в компьютер (3) |Наука II: Java | CS 113 Основные структуры данных (3) |и алгоритмы| ПРИМЕЧАНИЕ: Студенты также должны заполнить UCB | COMPSCI 47B в Беркли, чтобы удовлетворить | это требование.-------------------------------------------------------------------------------- COMPSCI 61C Конструкции машины (4) | НЕТ КУРСА СУЩЕСТВУЕТ -------------------------------------------------------------------------------- EL ENG 16A Информация о проектировании (4) | НЕТ КУРСА АРТИКУЛИРОВАНИЕ Устройства и системы I |-------------------------------------------------------------------------------- EL ENG 16B Информация о проектировании (4) | НЕТ КУРСА СУЩЕСТВУЕТ Устройства и системы II |-------------------------------------------------------------------------------- COMPSCI 70 Дискретная математика (4) | НЕТ КУРСА ИСКУССТВЕННО и теория вероятностей |-------------------------------------------------------------------------------- ВАЖНАЯ ИНФОРМАЦИЯ ОБ ЭТОМ ОСНОВНОМ: - указанные курсы были официально приняты этим профилем и одобрены как советником / преподавателем Беркли, так и офицером по артикуляции Беркли.- Часто консультируйтесь с ASSIST, чтобы получить текущую информацию, так как это соглашение о артикуляции подлежит периодическому пересмотру.-------------------------------------------------------------------------------- END OF MAJOR

Я хочу использовать эту таблицу внизу.Обязательные курсы.Я приложил оригинальный URL.

http://web2.assist.org/web-assist/report.do?agreement=aa&reportPath=REPORT_2&reportScript=Rep2.pl&event=19&dir=2&sia=MIRACSTA&ria=UCB&ia=UCB&oia=MIRACSTA&aay=16-17&ay=16-17&dora=EECS

1 Ответ

0 голосов
/ 28 февраля 2019

Вы можете анализировать таблицу с помощью регулярных выражений.Из этого документа я сделал следующие наблюдения:

  1. Я вижу, что у вас есть разделитель для курсов: --------------------------------------------------------------------------------
  2. Затем между этим разделителем у вас естьлевая и правая рука, разделенные трубками |.
  3. Кроме того, у вас есть число в скобках справа при цитировании модуля (например, (1)).

Часть 1 вы могли бы легко реализовать, части 2 и 3 можно частично решить с помощью регулярных выражений.
Я приведу здесь самую сложную часть решения, вы можете легко реализовать остальное, и, возможно, поместить ее в кадр данных pandas.

import re
# separate left hand and right hand 
strline = "course name |MATH 123 divide by 0 (1)"
left, right = re.split('\|',strline)  # split around the pipe
# find the parenthesis marker on the right
m = re.search(r'\(\d+\)',right)
has_module_name = m is not None

if has_module_name:
   # catch the module name, description and exclude number in parenthesis
   m_mod = re.match(r'([a-zA-Z0-9]+ [a-zA-Z0-9]+)([^\(\)]+).*',right)

   if m_mod is not None:
      mod_code = m_mod.group(1)
      mod_desc = m_mod.group(2)
      print("module name: {}".format(mod_code))
      print("module first line desc: {}".format(mod_desc))

# todo: make loops to catch other lines of desc, remove duplicate whitespaces

Возвращает:

module name: MATH 123
module first line desc:  divide by 0
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...