Fellow creates a querying and reasoning structure that allows students to find other like-minded individuals based on academic year, program, career goals, hobbies, and software experience. The long-term goal for this project is to build a web app that can be interacted with not only to find similar students, but also professor, university organizations, events, and more.
Note: the current repository already contains the final generated KRF file in dist/krf/fellow.krf
. To load it and run it in Companion, feel free to skip to the section Running Companion.
├── dev (development code)
│ ├── krf (intermediate krf files)
│ │ ├── facts.krf (defines entities, collections, and relations)
│ │ ├── people.krf (defines people entities scraped from survey)
│ │ ├── queries.krf (defines horn clauses for queries)
│ │ ├── query_definitions.krf (defines queries)
│ │ └── test-queries.krf (some included test queries to play with)
│ └── scraping
│ ├── Person.py (model for a Person)
│ ├── generate_krf.py (generates the combined dist/krf/fellow.krf file using the intermediate krf files)
│ └── sheet_scraping.py (generates the dev/people.krf by scraping the Google Sheet survey responses)
└── dist (distribution code)
└── krf
└── fellow.krf (combined krf file to use with Companions)
We use pipenv for managing package dependencies.
- Install pipenv using the link above.
- Run
pipenv install
to install package dependencies andpipenv shell
to start virtual environment with installed dependencies.
You will need Google authentication credentials in order to access Google Sheets.
- Follow the instructions from the gspread repository to get a
credential.json
file. - Put your
credential.json
file indev/scraping
.
We pull the spreadsheet URL from a .env
file that is loaded into the pipenv virtual environment when you run pipenv shell
. Generate one of these files using the format below and place it in the root of the cloned repository:
SHEET_URL=YOUR_GOOGLE_SPREADSHEET_URL
- Navigate to
dev/scraping/
- Run
python generate_krf.py
to scrape data from the Google Sheet and generate a single krf file for Companion. - Output file can be found in
dist/krf
.
- Startup companion and load the
dist/krf/fellow.krf
flat file into the interaction manager. - Browse the agent of the interaction manager to input queries and explore the knowledge base.
- To make sure everything is loaded correctly, try running the following query:
(sameAcademicYear DestinyLivingston ?suggestedPerson)
This should output students that have the same academic year as Destiny Livingston. Note: you must run the queries using the KRR-Winter2019FactsMt
microtheory.
Feel free to test more of the available queries and compose custom ones.
(sameAcademicProgram ?person ?suggestedPerson)
Example Query: (sameAcademicProgram DestinyLivingston ?suggestedPerson)
(sameAcademicYear ?person ?suggestedPerson)
Example Query: (sameAcademicYear DestinyLivingston ?suggestedPerson)
(sameFieldOfWork ?person ?suggestedPerson)
Example Query: (sameFieldOfWork DestinyLivingston ?suggestedPerson)
(sameSoftwareExperience ?person ?suggestedPerson)
Example Query: (sameSoftwareExperience DestinyLivingston ?suggestedPerson)
(sameAcademicInterests ?person ?suggestedPerson)
Example Query: (sameAcademicInterests DestinyLivingston ?suggestedPerson)
(sameHobbies ?person ?suggestedPerson)
Example Query: (sameHobbies DestinyLivingston ?suggestedPerson)
(interestingEvents ?person ?event)
Example Query: (interestingEvents DestinyLivingston ?event)
(personExperiencedWith ?suggestedPerson ?program)
Example Query: (personExperiencedWith ?suggestedPerson GameDevelopment)
(similarNUPerson ?person ?suggestedPerson)
Example Query: (similarNUPerson DestinyLivingston ?suggestedPerson)
The queries below are compositions of the basic queries listed above:
(sameHobbiesAndYear ?person ?suggestedPerson)
(sameMajorAndYear ?person ?suggestedPerson)
(sameHobbiesAndField ?person ?suggestedPerson)
(sameHobbiesWithExperienceIn ?person ?suggestedPerson ?program)
We define 3 custom queries that take the simple queries from earlier as input, along with a person to match to. These are custom queries that can be used to run any combination of simpler queries.
Example Query: (customQuery2 sameAcademicInterests sameHobbies DestinyLivingston ?suggestedPerson)
(customQuery2 ?query1 ?query2 ?person ?suggestedPerson)
(customQuery3 ?query1 ?query2 ?query3 ?person ?suggestedPerson)
(customQuery4 ?query1 ?query2 ?query3 ?query4 ?person ?suggestedPerson)
- If you want to create a new entity representing a NU student in the knowledge base, please check
dev/krf/people.krf
- Follow the structure and syntax, replacing information as needed.
- To facilitate the process, append the newly created data to the bottom of
dist/krf/fellow.krf
and reload it in Companion. - Now try running some queries related to your new user like such:
(sameAcademicYear newUser ?suggestedPerson)