AILT9019 · Team 11 · Final project, November 2026

Shanghai and Hong Kong Waste Sorting Helper

上海與香港垃圾分類助手

Type a household item in Chinese or English, pick a city, and get the local bin, how to prepare the item and the official rule it comes from. Sourced local rules decide the bin. An optional AI step can only choose between wordings we reviewed in advance.

▶ Demo video (link coming) ▶ 3-min presentation (link coming) Code repository (teaching team access)

Who it is for and what problem it solves

Users

Students and residents who move between Shanghai and Hong Kong, for example HKU students studying at both campuses, and anyone who knows one city's rules but not the other's.

Problem

The same item goes into different bins in the two cities. A plastic bottle is blue "Recyclable Waste" in Shanghai but the brown plastics stream in Hong Kong. General chatbots blend the two systems and rarely say where a rule comes from.

What it does not do

  • No recycling prices, collection-point addresses or opening hours.
  • No decision on whether something should be thrown away at all, and no medical, legal or commercial advice.
  • It does not replace the signs at your bins or your building's rules. Acceptance can differ between collection points.

How it works

Input → processing → output. Every step except the optional wording step is deterministic and runs offline with no API key.

1
Choose a cityShanghai or Hong Kong. Each city has its own dataset. An item that only exists in the other city's data never borrows that city's rule.
No city selected → the app asks for one.
2
Type the item, with bilingual autocompletePrefix/contains suggestions match Chinese or English aliases, e.g. typing 膠 suggests 膠樽 · plastic drink bottle. Suggestions only fill the box after you click one. Nothing is submitted automatically.
3
Normalise and look upFull-width to half-width conversion and other text clean-up, then an exact match against that city's reviewed alias index. Optional tags (e.g. "rinsed", "has food residue") apply fixed, sourced condition rules.
Material only ("plastic"), negation, two items at once, or conflicting tags → a follow-up question, not a guess.
4
Decide with local rulesThe matched entry gives the destination, bin colour, preparation, exceptions and the source clause.
Not in the city's data → "not covered in this city". Out of scope → a refusal with the reason.
5
Optional AI wording off by defaultWith the user's own DeepSeek key and consent, the model may pick one of two reviewed wordings. The city, item, bin, preparation and source must come back unchanged, or the app falls back to the local template.
✓
ResultBilingual destination, bin colour, preparation, caveats and a link to the official source. A badge says whether the wording came from the local template or the AI.

What our team built vs. what we reused

Team-built
  • Two city datasets (68 Shanghai + 45 Hong Kong entries), each with Chinese/English aliases, preparation, exceptions and source clause
  • Shared CLI and web workflow, safe-failure rules and condition tags
  • Bilingual autocomplete
  • AI output guard that checks the facts and falls back to the template
  • Test suites, held-out phrasing set and CSV export
Existing capabilities used
  • Python 3.10+ standard library: web server, JSON, unicode normalisation
  • Optional: DeepSeek API (deepseek-flash), only to choose a pre-written wording
  • Optional photo adapter for a vision model: suggests names only. Not evaluated with real photos.
  • Official rule documents from the Shanghai and Hong Kong governments

Domain customisation

Shanghai

Four categories from the Shanghai Household Waste Sorting Guidelines (2024), Table 2. Milk cartons and disposable lunch boxes depend on whether there is a dedicated local collection, so the app asks before deciding.

Hong Kong

Blue / yellow / brown recycling bins plus GREEN@COMMUNITY streams, each linked to its EPD FAQ question. An item that GREEN@COMMUNITY does not accept is not automatically sent to general waste. Special items point to official guidance.

A real run

Screenshots of the actual app running locally in offline mode (python src/app.py --offline), 18 November 2026. No API key was used and none of these are mock-ups.

Shanghai result for plastic bottle: Recyclable Waste, blue bin, empty, rinse and flatten, with the 2024 guideline as the source
Shanghai · "plastic bottle" → Recyclable Waste, blue bin. Empty, rinse, flatten. Source: 2024 guidelines, Table 2.
Hong Kong result for plastic bottle: plastic recycling, brown bin, with an acceptance caveat and the EPD FAQ Q6 source
Hong Kong · same input → plastic recycling, brown bin, with an acceptance caveat. Source: EPD FAQ Q6.
Typing 膠 shows six bilingual suggestions such as 膠樽 plastic drink bottle and 膠袋 plastic bag
Autocomplete: one Chinese character gives bilingual candidates. The user still chooses one and submits it.
Input plastic returns: material alone is insufficient, name the actual item
Boundary case: "plastic" alone is not enough to decide. The app asks for the actual item and gives no category.

Run it yourself

Requires Python 3.10+. The core app, tests and exporter use only the standard library, so there is nothing to pip install and no API key is needed.

git clone https://github.com/hryLiuYibo/AILT9019_Team11_Project.git
cd AILT9019_Team11_Project
python tests/run_tests.py          # prints ALL PASS
python src/app.py --offline        # then open http://localhost:8000

Or use the command line:

python src/classify.py "plastic bottle" --city shanghai
python src/classify.py "plastic bottle" --city hongkong
python src/classify.py "milk carton" --city shanghai --tag cond_no_special_collection
CityInputExpected output
Shanghaiplastic bottleRecyclable Waste, blue; empty, rinse and flatten
Hong Kongplastic bottlePlastic recycling, brown; empty and rinse; follow signage
Hong Kongmilk cartonGREEN@COMMUNITY beverage-carton stream
Shanghaimilk cartonAsks whether a dedicated collection exists
EitherplasticAsks for the actual item; no category
Eitherrinsed + food residue tagsConflict; no category

The code repository is private to the team and the teaching team. If you are a classmate, the demo video shows the same workflow running end to end.

Evaluation results

Question: does the app give the sourced, city-correct destination for items it knows, and does it refuse or ask, instead of guessing, for everything else?

TestResultWhat it shows
Shanghai baseline cases84 / 84Destination, refusal and unknown cases all as expected
Hong Kong cases99 passIndependent HK dataset, no Shanghai rule borrowed
Tag / condition cases19 / 19Conditions change the result. Conflicts are refused.
Held-out phrasings, exact + top-3 autocomplete10 / 20 per cityFree-form wording coverage is limited (see below)
Held-out, after user picks the canonical name20 / 20 per cityOnce the item is named, the decision is correct (controlled replay, not a user study)
Ambiguous / unknown inputs0 / 10 guessedNo unsafe automatic assignment
Live AI wording (DeepSeek)1 smoke testOne real query on 13 Nov 2026 kept all facts unchanged. Not a reliability test.

Counts from tests/run_tests.py, tools/check_recording.py and tools/evaluate_recall.py, offline run on 13 November 2026. Some suites contain nested cases, so the rows should not be added together.

Failure cases and limitations

Observed failure: free-form wording

Only half of the held-out phrasings (10/20 per city) are found by exact lookup or the top-3 suggestions. A user who writes "used PET bottle from the vending machine" may get "not covered" even though "plastic drink bottle" is in the data. The cause is that we match exact names and aliases and do no fuzzy or semantic matching. We chose that on purpose, because a fuzzy match could quietly pick the wrong bin.

Possible next step: fuzzy candidates that are only suggested and never decided, tested on the same frozen held-out set.

Scope limits

  • Only the 113 items in the datasets. Hong Kong food waste is not covered yet.
  • Rules were checked against the official sources on 13 Nov 2026 and can change.
  • The photo feature has zero real-photo evaluations. No recognition accuracy is claimed.
  • No real user study has been run.

Ethics, data and AI use

  • Data: public government pages only: the Shanghai 2024 sorting guidelines, the Shanghai official English FAQ, the HK EPD GREEN@COMMUNITY FAQ and the HK government note on recycling bin colours. No personal data is collected.
  • Risk: a wrong answer could send an item to the wrong stream. Mitigations: every answer shows its source, the app asks instead of guessing, and the AI cannot change the decision.
  • API keys are kept only in the page for that request. They are never written to disk or browser storage and are removed by Clear or a page refresh.
  • Photos (optional) need explicit consent, have their metadata stripped before upload, and only produce suggested names.
  • AI-assisted development: an AI coding assistant helped with implementation, tests, data structuring and documentation. Team members reviewed the sources, code and claims. Full disclosure is in Section 5 of the final report.

Team 11

LIU YiboLU Song LunWEN Sum YeeWANG Zixuan

AILT9019 AI Literacy for Computing and Data Science, The University of Hong Kong, 2026.