Post Reply 
Improving the Help text on HP Prime
07-03-2024, 07:51 AM
Post: #1
Improving the Help text on HP Prime
Hello all,

We're currently working out some new improvements (new release is coming!!) and are currently also looking at improving the documentation around Prime. One of the being the integrated Help-option.

There’s been significant interest expressed amongst some of our beta testers on improving the text in the online (integrated into the calculator) help. Some of the descriptions are out of date or inconsistent as this hasn't been a priority in the last years.

To get this task done as good and fast as possible, we're looking for an extension of the beta-testing team. If you're interested in supporting us with development on Prime and this task in particular, please send your contact details to klaas.kuperus@moravia-consulting.com. The way this would work on the subject, is to provide you with the XML files. The English XML file was posted before project transition to Moravia (https://www.hpcalc.org/details/9286) and we are keen on updating this.

Thanks for the ongoing support and let's hope for many replies. Smile

Product Manager HP for MORAVIA Consulting, the EMEA & AP Licensee for HP Calculators.

http://www.hpcalcs.com
Find all posts by this user
Quote this message in a reply
07-03-2024, 09:02 AM (This post was last modified: 08-29-2024 06:48 PM by ftneek.)
Post: #2
RE: Improving the Help text on HP Prime
Klass, would it be possible to upload an XML file for the current public release?

Attached is a small python script I'm using to search through the published XML file / help text, off-calculator. This can make it easy(er) to browse through search hits, and potentially notice things to improve. You should download the XML file linked in the first post, a more recent XML file would allow for more recent / relevant help text to appear in the results.

Code:
# Search for a command or phrase in the Help Catalog
# by ftneek
import xml.etree.ElementTree as ET
from typing import List, Tuple


# Load and parse the XML file with error handling
try:
    tree = ET.parse('HelpEn.xml')
    root = tree.getroot()
except ET.ParseError as e:
    print(f"Error parsing XML: {e}")
    exit(1)
except FileNotFoundError:
    print("The specified XML file was not found.")
    exit(1)


# Define a function to search for a specific feature or command
def search_feature(feature: str) -> List[Tuple[str, str, str, str, str, str]]:
    results = []
    for help_item in root.findall('HelpItem'):
        long_title = help_item.findtext('LongTitle', default="None")
        short_title = help_item.findtext('ShortTitle', default="None")
        HID = help_item.findtext('HID', default="None")
        help_text = help_item.findtext('help', default="None").strip()
        example_text = help_item.findtext('Examples', default="None").strip()

        related = ", ".join([also.text for also in help_item.findall('also') if also is not None]) or "None"

        for item in [long_title, short_title, HID, help_text, example_text]:
            if feature.lower() in item.lower():
                results.append((long_title, short_title, HID, help_text, example_text, related))
                break

    return results


def format_search_results(search_results: List[Tuple[str, str, str, str, str, str]]) -> str:
    formatted_results = []
    for long_title, short_title, HID, help_text, example_text, related in search_results:
        examples = "Example(s):" + (" " if example_text == "None" else "\n")

        formatted_results.append(
            f"HID: {HID}\n"
            f"Long Title: {long_title}\n"
            f"Short Title: {short_title}\n"
            f"{help_text}\n\n"
            f"{examples}{example_text}\n\n"
            f"See Also: {related}\n~~~~~~~"
        )
    return "\n".join(formatted_results)


if __name__ == '__main__':
    # Search for the feature
    feature_to_search = input("Search for: ").strip()
    print("~~~~~~~")
    search_results = search_feature(feature_to_search)

    # Check if results are found and format the search results
    if not search_results:
        print(f"No results found for '{feature_to_search}'.")
    else:
        formatted_search_results = format_search_results(search_results)
        print(formatted_search_results)

For example when searching for 'fracmod', the following is displayed in the terminal

Code:
Search for: fracmod
~~~~~~~
HID: CASfracmod
Long Title: None
Short Title: fracmod
Syntax:
fracmod(Expr, Integer)

For a given expression and an integer n, returns the fraction a/b such that a/b=Expr mod n, where -√n/2<a≤√n/2 and 0≤b<√n/2

Example(s):
fracmod(41,121) ----> 2/3

See Also: CASchrem
~~~~~~~

One simple improvement that someone could suggest would be to remove the extra closing parentheses in

Code:
fracmod(Expr,Integer))

If more things get noticed, more things get fixed Smile

edit: I noticed that HP Museum didn't allow a .py file upload here. Shouldn't that be changed, since the Prime supports a version of micro python?

- neek
Find all posts by this user
Quote this message in a reply
07-03-2024, 10:27 AM
Post: #3
RE: Improving the Help text on HP Prime
(07-03-2024 07:51 AM)KlaasKuperus Wrote:  Hello all,

We're currently working out some new improvements (new release is coming!!) and are currently also looking at improving the documentation around Prime. One of the being the integrated Help-option.

There’s been significant interest expressed amongst some of our beta testers on improving the text in the online (integrated into the calculator) help. Some of the descriptions are out of date or inconsistent as this hasn't been a priority in the last years.

Please, please, PLEASE allow Terminal to use a fixed-width font, maybe make it available as an option in Setup (or even better, give the user a choice of fonts and allow new fonts to be added!)

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
07-03-2024, 01:41 PM
Post: #4
RE: Improving the Help text on HP Prime
(07-03-2024 10:27 AM)toml_12953 Wrote:  Please, please, PLEASE allow Terminal to use a fixed-width font, maybe make it available as an option in Setup (or even better, give the user a choice of fonts and allow new fonts to be added!)

Have you tried my solution for outputting fixed-width font to the terminal?

   

Piotr Kowalewski
Find all posts by this user
Quote this message in a reply
07-08-2024, 07:51 PM
Post: #5
RE: Improving the Help text on HP Prime
By the way, I updated the code in my post above. Mostly some formatting changes, but it now looks for matches in the Help text as well as long title, short title, HID, and examples.

- neek
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)